AQA A-Level Computer Science 4.2 Fundamentals of data structures: arrays, queues, stacks, graphs, trees, hash tables and dictionaries
A deep-dive AQA A-Level Computer Science guide to 4.2 Fundamentals of data structures. Covers arrays and records, queues, stacks, graphs, trees, hash tables and dictionaries, with how each works, its operations, and when to use it.
Reviewed by: AI editorial process; not yet individually human-reviewed
Jump to a section
What 4.2 actually demands
Data structures are the containers algorithms work on. AQA expects you to know how each structure works, to trace its operations by hand, and to choose the right structure for a problem, justifying the choice. This module runs from simple arrays and records up to graphs, trees and hash tables, and pairs directly with the algorithms module.
Arrays and records
An array holds many items of the same type accessed by index, in one, two or three dimensions. A record groups fields of different types under one name. The key distinction here is static versus dynamic structures: a static structure has a fixed size, a dynamic one grows and shrinks at run time using the heap.
Stacks and queues
A stack is LIFO (push and pop at the top), used for reversing data, expression evaluation and the call stack that handles subroutine calls and recursion. A queue is FIFO (enqueue at the rear, dequeue at the front); a circular queue reuses freed slots with modulo arithmetic and a priority queue serves the highest-priority item first.
Graphs and trees
A graph is vertices joined by edges, directed or undirected, weighted or not, stored as an adjacency matrix (fast lookup, more memory) or an adjacency list (memory-efficient for sparse graphs). A tree is a connected acyclic graph with a root; a binary search tree orders values left-smaller, right-larger for fast searching and a sorted in-order traversal.
Hash tables and dictionaries
A hash table stores key-value pairs by hashing the key to an index, giving average constant-time access, with collisions resolved by rehashing or chaining. A dictionary is the abstract data type of unique key-value pairs, usually implemented with a hash table.
Check your knowledge
- State the difference between a static and a dynamic data structure. (2 marks)
- State the order in which items leave a stack and a queue. (2 marks)
- Explain one advantage of a circular queue over a linear queue. (2 marks)
- Give one reason to use an adjacency list rather than an adjacency matrix. (2 marks)
- State what an in-order traversal of a binary search tree produces. (1 mark)
- Define a collision in a hash table. (1 mark)
- Describe how chaining resolves collisions. (2 marks)
- State what a dictionary stores and how it is usually implemented. (2 marks)
Sources & how we know this
- AQA A-level Computer Science (7517) specification — AQA (2015)