Skip to main content
EnglandComputer ScienceSyllabus dot point

How do stacks, queues and linked lists work, and how are they implemented and used?

Dynamic data structures: stacks (LIFO) and queues (FIFO) with their push, pop, enqueue and dequeue operations and pointer management, linear and circular queues, and singly and doubly linked lists with insertion and deletion.

An Eduqas Component 1 answer on stacks, queues and linked lists: LIFO and FIFO behaviour, push, pop, enqueue and dequeue with pointer management, the wrap-around in a circular queue, and inserting and deleting nodes in a linked list.

Generated by Claude Opus 4.814 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

Eduqas wants you to describe stacks and queues, their operations and pointer management, the wrap-around in a circular queue, and how a linked list inserts and deletes nodes by changing pointers. These are the core dynamic structures: unlike a fixed array, they model data that grows and shrinks.

The answer

Stacks (LIFO)

Queues (FIFO) and circular queues

Linked lists

Examples in context

The call stack is a stack: each function call pushes a frame and each return pops one, which is exactly why infinite recursion causes a stack overflow. A print spooler is a queue: documents print in submission order. A circular buffer (a circular queue) backs streaming audio so freed slots are reused continuously. Linked lists underpin structures that change size a lot, such as the chains in a hash table or the adjacency lists of a graph, both of which Eduqas covers in the next dot point.

Try this

Q1. State the order of removal for a stack and for a queue. [2 marks]

  • Cue. Stack: last in, first out (LIFO). Queue: first in, first out (FIFO).

Q2. A circular queue of size 88 has its rear pointer at index 77. After one more enqueue, what is the rear index? [1 mark]

  • Cue. (7+1)β€Šmodβ€Š8=0(7 + 1) \bmod 8 = 0.

Q3. Give one advantage and one disadvantage of a linked list compared with an array. [2 marks]

  • Cue. Advantage: grows and shrinks at run time with cheap insertion and deletion. Disadvantage: no direct indexing, so reaching an item needs an O(n)O(n) traversal from the head.

Exam-style practice questions

Practice questions written in the style of WJEC Eduqas exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Eduqas 20206 marksA stack is implemented in an array with a top pointer initially set to βˆ’1-1. Describe, using pseudocode, the push and pop operations, including how an overflow and an underflow are detected.
Show worked answer β†’

Push (up to 3 marks): check for overflow first, then increment the pointer, then store the value.

PROCEDURE push(value)
    IF top = maxIndex THEN
        REPORT "stack overflow"
    ELSE
        top <- top + 1
        stack[top] <- value
    ENDIF
ENDPROCEDURE

Pop (up to 3 marks): check for underflow first, then read the value, then decrement.

FUNCTION pop()
    IF top = -1 THEN
        REPORT "stack underflow"
    ELSE
        value <- stack[top]
        top <- top - 1
        RETURN value
    ENDIF
ENDFUNCTION

Markers reward incrementing the pointer before storing on push, decrementing after reading on pop, and the overflow (top at the maximum) and underflow (top at βˆ’1-1) checks.

Eduqas 20224 marksExplain why a circular queue is often preferred to a linear queue implemented in an array, and describe how the rear pointer wraps around.
Show worked answer β†’

In a linear array queue, repeated enqueues and dequeues move both pointers towards the end, so the front of the array becomes unusable even when the queue is not full, wasting space (up to 2 marks).

A circular queue treats the array as a ring: when the rear pointer reaches the last index, the next enqueue sets it back to index 00 using modulo arithmetic, rear←(rear+1)β€Šmodβ€Šsize\text{rear} \leftarrow (\text{rear} + 1) \bmod \text{size}, so the freed front slots are reused (up to 2 marks).

Markers reward the wasted-space problem of the linear queue and the modulo wrap-around of the circular queue. A full-or-empty distinction (using a counter or a spare slot) earns credit too.

Related dot points

Sources & how we know this