Data structure
An organised means of storing related data.
7 examples of data structures
Array
A data structure that stores multiple data items of the same data type.
Element of an array (2)
3 advantages of an array.
Disadvantage of an array.
Cannot be dynamically resized in most languages.
Record
A data structure to store multiple pieces of data with may have different data types.
Field
A single item of data within a record.
Stack
A FILO or LIFO data structure where data items can be pushed or popped.
FILO
First In Last Out
LIFO
Last In First Out
Pushed
When an item is added to the top of the stack.
Popped
When an item is taken from the top of the stack.
What is significant about the top of the stack?
It is the only position where a record can be added or removed.
How can a stack be implemented? (2)
Stack pointer
To contain the index of the most recent data item added.
How do you push records using arrays and variables? (2)
How do you pop records using arrays and variables? (3)
*Practical uses for stacks (3)
*Practical uses for stacks (3)