AS §10.4 · A2 §19.1
ZAK's Data Structures Playground
The exam never asks “what is a stack” — it gives you five operations and a blank array and says show the contents and the pointers. Push, pop, enqueue, insert into the free list, build the tree, hash the key: every operation redraws the array the way the mark scheme does and shows the pseudocode that earns the marks. Then let Practice set you the question.
Loading the playground…
Example library
Stacks 3
Push, pop, peek, overflow and underflow with TopPointer
Queues 3
Linear and circular queues with front / rear pointers and wrap-around
Linked lists 3
Array of nodes with StartPointer and the free list
Binary trees 4
Left / Data / Right arrays, insertion, the three traversals
Dictionaries / hash tables 3
Hashing, collisions and linear probing
Conventions the exam uses (and this lab follows)
- Stack: array 1..MaxSize,
TopPointer0 when empty; POP moves the pointer but leaves the value in the array. - Linear queue:
FrontPointer1 andRearPointer0 when empty; it is full when RearPointer = MaxSize even if the front has been dequeued — that is the argument for the circular queue, whose pointers wrap with MOD and which keeps a Count. - Linked list: nodes in an array with Data and Pointer columns,
StartPointerinto the list,FreePointerinto the chain of unused nodes; 0 is the null pointer. A deleted node goes to the head of the free list. - Binary search tree: Left / Data / Right arrays with
RootPointerandFreePointer; smaller values left, larger right; in-order gives sorted output. - Hash table: key MOD table size (ASCII sum for words), collisions resolved by linear probing; a deleted slot keeps a marker so later probes still pass through.