This section looks a various ways of storing and processing data, some of which are often referred to as Abstract Data Types (ADT). Various methods of storing data, reasons for choice of method and various uses for each method.
WHAT IS MEANT BY: DATA STRUCTURES
Data structure are the way we hold/store data methods we can use to process the data. For example a printer uses a FIFO (First In First Out) queue for items waiting to print, meaning that the first item in the queue to print is the first item to be printed, other methods such as LIFO (Last in First Out) are often used. Imagine at a shipping port - the last container on placed on top of a pile of containers needs to be the first container to be removed, the computer system behind this would use a LIFO method.
You may have already used various methods of storing data when you have been writing code. You have probably used variables to store single items of data, single dimensional lists to store simple related data and multiple dimension list to store more complex related data.
If we take the example of a transport system, the names of train stations could be held in a simple 1 dimensional array such as; trainStations = ['Liverpool St', ' Oxford St', 'Piccadilly Circus'] However we would expect the timetable to be presented in a 2 dimensional array showing the departure, destination and possible times such as; timeTable ['[Liverpool St', ' Oxford St', '9:00am', '10:00am', '11:00am'], [' Oxford St', Liverpool St', '9:20am', '9:40am','10:00am'],[' Oxford St', 'Piccadilly Circus','9:30am','9:45am','9:50am'],['Piccadilly Circus',' Oxford St','9:10am','9:20am','9:30am']]
The way we store data also has a big impact on how efficient it is to search and manipulate the data.
This chapter looks at various methods of storing and retrieving data and the efficiency relating to each method.