1.4.2 Flashcards
stacks
A data structure that operates on a first in last out basis.
queues
A data structure that is first in first out
array
a data structure that holds multiple pieces of data within a single identifier.
records
Can store multiple values under one identifier
The data can be of different data types
Describe how a 1D array can be set up and used to push and pop items as a stack
Array size defined
A stack pointer is used to point to the top of the stack
When an item is pushed the stack pointer is incremented
When an item is popped the stack pointer is decremented
Describe the decision that needs to be made in each sub-program and how this impacts
the next process.
push()
pop()
Check if the stack is full (pointer = array.length/array.length+1)
If it is not – insert the item
If it is – return/error that the stack is full
Check if the stack is empty (pointer = 0/1)
If it is – return/error that the stack is empty
If it is not – return the item
Explain the similarities and differences between a record and a class
Record is a data structure…
…A class is a template for making data structures (objects)
Class also has methods (which describes functionality)
Both store data of different types
Which can be accessed by their names
But classes can make them accessible via methods
Both can have multiple ‘instances’
Class can include visibility of properties / private