What is a data structure?
A data structure is a store of a group of related items
What is an array?
It is a data store where:
What is a record?
A record is a set of data items which are all related to one entity
What is a stack?
It is a data store in the form of a linear list where the list items added are the first items to be removed
- Uses a stack pointer is a small register that stores the address of the last program request in a stack
Give an example of where a stack is used
- Good when using reverse polish notation
What is a queue?
A queue is a data structure where data can only be added to the end of it and is then retrieved from the front of the queue
- A queue has two queue pointers, one for the front and one for the rear
What is a binary tree?
Trees are a large store of data and are quick to search through but needs to be balanced to be efficient
What is pre-order, in-order and post-order
What is a linked list?
Has a logical order which is different to its physical order (data items can be anywhere in memory)
- Each item in the list is composed of two parts, data and a pointer to the next item to the list
What’s a benefit and dis-advantage of using a linked list?
Give an example of where a queue would be used
- Keyboard buffer
Why’s it bad for a binary tree to be unbalanced?
An unbalanced binary tree can significantly increases the number of comparisons to be made when searching through the tree.
What is hashing?
Hashing uses is the mod function to store different items of data in a table according to its remainder. If a data collision occurs, it goes into the overflow area.
Give an advantage and disadvantage of hashing
What is the top/first item in a binary tree known as?
The root node
Describe the pseudo code for adding an item to a circular queue:
If NumOfItems = MaxIndex Then
Output error message
Else
If rearPointer = MaxIndex Then
rearPointer = 1
Else
Increment rearPointer by 1
End if
Increment NumOfItems by 1
Queue(rearPointer) = new item
End ifDescribe the pseudo code for retrieving an item from a circular queue:
If NumOfItems = 0 Then
Output error message
Else
Use for Data = Queue(frontPointer)
NumOfItems -= 1
If frontPointer = MaxIndex Then
frontPointer = 1
Else
Increment frontPointer by 1
End if
End ifDescribe the pseudo code for pushing an item onto a stack:
If Top = MaxIndex Then
Output error message
Else
Increment Top by 1
Stack(Top) = New data
End ifDescribe the pseudo code for popping an item off a stack:
If Top = 0 Then
Output error message
Else
UseForData = Stack(Top)
Top -= 1
End ifWhat are the benefits and drawbacks of a binary tree?