Data Structures
Data Structures
- Data structures are a way of organizing and storing data, so that they can be accessed and worked with efficiently.
Arrays
- An array is a data structure that contains a group of elements. Typically, these elements are all of the same data type, such as integers or strings.
- Arrays can be one-dimensional, or they can be multi-dimensional.
- Each item in an array has a unique position, identified by an index or key. In most programming languages, array indices start at 0.
Stacks and Queues
- Some data structures work as a list with a specific set of rules for adding and removing elements.
- A stack operates on a “last-in-first-out” basis, sometimes referred to as LIFO. The last item you put onto the stack will be the first one to come back off.
- A queue, on the other hand, operates on a “first-in-first-out” basis, or FIFO. The first item you put onto the queue will be the first one that comes off.
Records
- A record is a data structure that groups related items together. Unlike arrays, the items in a record could be different types.
- Each item in a record is identified by a unique field name.
Files
- In computing, a file is a block of arbitrary information, or resource for storing information, which is available to a computer program.
- Files are used to store data and instructions for long-term storage and later retrieval.
Lists
- A list is another common type of data structure, which is essentially a collection of ordered items.
- Unlike arrays, lists can easily handle the insertion, deletion, and relocation of elements.
Trees and Graphs
- A tree is a more complicated data structure that can be used for many applications including organisational hierarchies and decision trees.
- A graph on the other hand is used to model pairwise relations between objects in certain applications. These are advanced topics not typically covered at GCSE level, but you may come across them in further study.
Remember, understanding how each of these structures work and when to use them is a key part of computer science.