Arrays

#Arrays

Section 1

#Section-1

Lists (also known as the array abstract data type) are often implemented by the array data structure.

  • Array (Abstract Data Type)
    • The array is a basic abstract data type that holds an ordered collection of items accessible by an integer index.
    • It can either be implemented by an array (data structure) or a dynamic array.
      • Arrays (data structure) are a type of linear data structure that can hold an ordered collection of values. The array data structure specifies an implementation that the values are of homogeneous size and stored in contiguous memory.
      • The dynamic array is able to change its size during program execution. This property gives the dynamic array more power in programs where the programmer does not know how much data will enter the array at any given point.

Section 2

#Section-2

The items in an array can be anything from primitive types such as integers to more complex types like instances of classes.

For a Array (data structure), the size is fixed and cannot add more values than it's size unless the array is resized or something is taken out.

Each "slot" in the array has an associated number, called an index. By using these numbers, the programmer can directly index into the array to get specific values, which makes them very efficient.