Arrays are Amazing!!! | Learning Data Structures with CompAndCode #3

Intro:

Arrays are one of the more simpler data structures out there, meaning they are fundamental to your learning in Computer Science. I'm aiming to simply explain them, provide value and then implement them so that you have an example in code. LETS GO!!!!


Theory:

  • An array is a 'finite, ordered set of elements'.

  • They're denoted by [].

  • This means that the length cannot change, it's predefined.

  • 'Ordered' refers to the fact that each element is indexed, starting from 0.

  • Reference items like this: arrayName[0].

  • The datatype within the array has to be the same for e.g. ["robin", "blackbird"] (all strings).

1D arrays can be visualised as a list of items, simply one after another (shown above).


2D arrays can be visualised as a table.