HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

What is a contiguous subarray?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
subarraywhatcontiguous

Problem

What is a contiguous subarray? I have tried searching online and have found pages about solving the largest contiguous subarray problem but none with a definition or explanation of what contiguous in this actually is.

Ex: Wikipedia: Maximm subarray problem has no explanation of why the given "subarray" is contiguous or what contiguous means in the context.

Solution

This is just the ordinary dictionary definition of "contiguous": all adjacent in space. A subarray is defined by any subset of the indices of the original array; a contiguous subarray is defined by an interval of the indices: a first and last element and everything between them.

Context

StackExchange Computer Science Q#43303, answer score: 9

Revisions (0)

No revisions yet.