Push 3, push 7, pop, push 5. What is on top of the stack?
- After pushes: 3, 7 (top).
- Pop removes 7.
- Push 5: top is 5.
Answer 5
A-level Computer Science revision · Data structures and algorithms
A stack is LIFO (last in, first out): push adds to the top, pop removes from the top. A queue is FIFO (first in, first out): enqueue at the rear, dequeue from the front; a circular queue reuses space. A linked list stores nodes with data and a pointer to the next node, so items can be inserted without shifting others.
Watch out Popping from an empty stack is an underflow error.
Push 3, push 7, pop, push 5. What is on top of the stack?
Answer 5
A queue starts empty. Enqueue 4, enqueue 9, dequeue, enqueue 2. What value is at the front?
Which data structure is used to store return addresses when subroutines are called?
What is an advantage of a linked list over an array?
A-level Computer Science Pro, OCR H446
£119 once
Price rises to £199 on 1 January. Save £80 by joining before then.
At least 12 months of access
No VAT is charged.