Essential algorithms for GCSE and A Level Computer Science

Fundamental data structures

A feature of imperative programming languages, these abstractions of memory allow for the creation of higher order data structures.

What is an array?

An array is a collection of items (called elements) of the same data type.  An array is used to hold a collection of data that would otherwise be stored in multiple variables. For example, to store the names of four people, you could have four variables: name1, name2, name3 and name4. The problem with this approach is that it would not be possible to refer to a specific name or loop through all the names with a for or while command. That is because the number or index is part of the identifier (name of the variable). Instead, we need to declare name1 as name[1] and so on. 

Note how the index is now enclosed in brackets. Some programming languages used curved brackets while others use square brackets.

Array videos

What extra is in the book?

This algorithm / data structure has its own dedicated chapter in the book, which includes:

  1. Overview
  2. Typical applications / uses
  3. Typical operations
  4. The algorithm written out in simple-structured English
  5. The algorithm written out in pseudocode
  6. Full code listing Python
  7. Full code listing in Visual Basic
  8. Diagrammatic walk-through
  9. Efficiency discussion with reference to Big-O notation

A hard copy of the book is available on our shop and a free PDF copy is included for all premium subscribers.