Skip to main content
EnglandComputer ScienceSyllabus dot point

What data structures store collections of data, and how do stacks, queues, linked lists, trees and hash tables differ?

Data structures: arrays, records, tuples and lists, the stack and queue abstract data types and their operations, linked lists, trees and graphs, and hash tables, including how each is used and its advantages.

An OCR H446 answer on data structures: arrays, records, tuples and lists, the stack and queue abstract data types with their operations, linked lists, trees, graphs and hash tables, including how each is used and its advantages and disadvantages.

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

OCR wants the common data structures, arrays, records, tuples, lists, stacks, queues, linked lists, trees, graphs and hash tables, with how each works, its operations and its uses. Expect a "stack versus queue" question and a "how does a hash table work" question.

The answer

Arrays, records, tuples and lists

Stacks and queues

Linked lists, trees, graphs and hash tables

Examples in context

The call stack manages every subroutine call and is why recursion uses memory. Operating-system schedulers and print spoolers use queues. Hash tables back dictionaries and database indexes for fast lookup. Trees structure file systems and binary search trees; graphs model maps and social networks (traversed by BFS and DFS). OCR links this to the searching and traversal algorithms that operate on these structures, and to choosing the right structure when designing the Programming Project.

Try this

Q1. State the order in which items leave a stack and a queue. [2 marks]

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

Q2. State one advantage of a linked list over an array. [1 mark]

  • Cue. It can grow and shrink dynamically, and insertion/deletion just re-links pointers without shifting elements.

Q3. Explain what a collision is in a hash table and one way to handle it. [2 marks]

  • Cue. A collision is when two different keys hash to the same index; it can be handled by chaining (a list at that index) or open addressing (probing for the next free slot).

Exam-style practice questions

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

OCR 20206 marksExplain the difference between a stack and a queue, naming the operations on each, and give one use of each in a computer system.
Show worked answer →

Stack (up to 3): a stack is a last in, first out (LIFO) structure; items are added (push) and removed (pop) at the same end (the top), and peek reads the top without removing it. Use: storing return addresses and local variables during subroutine calls (the call stack), or implementing undo.

Queue (up to 3): a queue is a first in, first out (FIFO) structure; items are added (enqueue) at the rear and removed (dequeue) from the front. Use: holding processes ready to run (scheduling), a print spooler, or buffering data such as keyboard input. Markers reward LIFO with push/pop for the stack, FIFO with enqueue/dequeue for the queue, and a valid use of each.

OCR 20216 marksExplain how a hash table stores and retrieves data quickly, what a collision is, and one way collisions can be handled.
Show worked answer →

How it works (up to 3): a hash table applies a hash function to a key to compute an index (the hash) into an array, and stores the item at that index. To retrieve an item, the same hash function is applied to the key to go straight to its index, giving very fast (close to O(1)O(1)) lookup, insertion and deletion on average, without searching.

Collisions and handling (up to 3): a collision occurs when two different keys hash to the same index. It can be handled by chaining (storing a list of items at that index) or by open addressing / probing (placing the item in the next free slot). Markers reward hashing the key to an index for near-constant-time access, the definition of a collision (two keys, same index), and one valid resolution method.

Related dot points

Sources & how we know this