From the course: Programming Foundations: Algorithms

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Arrays

Arrays

- [Instructor] One of the simplest data structures is the array, and if you've done any prior programming, it's likely that you've worked with arrays before. An array is a collection of elements where the position of each element is identified by an index or a key value, and they're usually stored in a single contiguous block of memory. In its simplest form, an array just contains a linear set of values, which is often called a one-dimensional array, which I've shown here. One of the great features of an array is that the element positions can be calculated using a mathematical expression. This enables array elements to be accessed directly in what is usually called random access fashion. In other words, since the position of each element can be directly computed, it's not necessary to navigate the data structure in order to access a particular element. Arrays in most languages start their indexes at zero for the…

Contents