AQA A-Level Computer Science Paper 1, June 2025: Question 1

11 marks · Medium difficulty · Short Answer

Explain principles of hash tables and their operations, compare linear and binary search complexities, and evaluate tractability and passes for sorting algorithms.

Practise this question

Question

Question 01 consists of eight sub-questions: 01.1 asks to explain why a record in a hash table can normally be found faster than in a sorted list (1 mark). 01.2 asks to describe the steps to add a new record to a hash table (4 marks). 01.3 asks why search time in a hash table increases when many records are stored (1 mark). 01.4 asks why linear search has time complexity O(n) (1 mark). 01.5 asks why binary search has time complexity O(log n) (1 mark). 01.6 asks for one advantage of linear search compared to binary search (1 mark). 01.7 asks why bubble sort and merge sort are tractable algorithms (1 mark). 01.8 asks after how many passes bubble sort is guaranteed to sort a list of 100 items (1 mark).
Question text

01 Two data structures that can be used to store a collection of data records are a hash

table and a sorted list.

01.1 Explain why a record in a hash table can normally be found more quickly than a

record in a sorted list.

[1 mark]

01.2 Describe the steps involved in adding a new record to a hash table.

[4 marks]

01.3 Explain why the time taken to find a specific record in a hash table can increase when

lots of records are stored in the table.

[1 mark]

Linear search and binary search are two algorithms that could be used to find a record

in a sorted list.

01.4 Explain why the linear search algorithm has time complexity of O(n).

[1 mark]

01.5 Explain why the binary search algorithm has time complexity of O(log n).

[1 mark]

01.6 State one advantage of a linear search compared to a binary search.

[1 mark]

If the list of records was unsorted, a bubble sort algorithm or a merge sort algorithm

could be used to sort the records.

01.7 Explain why both these sorting algorithms are tractable.

[1 mark]

01.8 After how many passes is bubble sort guaranteed to have sorted any list of

100 items?

Mark scheme

Show the mark scheme Mark scheme table for Question 01 detailing marks for parts 1 through 8. 01.1 awards 1 mark for hashing function determining memory location/index or no need to search through records. 01.2 awards 4 marks for applying hashing algorithm to key, inserting data at index, and handling collisions. 01.3 awards 1 mark for mentioning more collisions leading to indirect access/rehashing. 01.4 awards 1 mark for worst case n comparisons or linear growth. 01.5 awards 1 mark for halving the search space each comparison. 01.6 awards 1 mark for linear search working on unsorted lists. 01.7 awards 1 mark for having polynomial (or better) time complexity. 01.8 awards 1 mark for the answer 99.

Question Marks

01 1 Mark is for AO1 (understanding) 1

Hashing algorithm/function will determine the memory location/index used;

No need to search through records to find the required one;

Max 1

01 2 All marks AO1 (understanding) 4

1. Apply hashing algorithm/function;

2. To (unique/primary) key; NE. data

3. Insert data at the index (A. address/memory location) obtained from this

process;

4. If there is already data there, use a suitable method for collision handling;

A. by example

01 3 Mark is for AO1 (understanding) 1

More collisions occur meaning direct access will not happen as frequently // more

collisions occur meaning more items will not be stored at the calculated index

(A. address/memory location) (given by the hashing function/algorithm);

NE. more collisions occur

A. description of a collision resolution method being used, eg need for a linear

search if multiple results have the same result from the hashing function

01 4 Mark is for AO1 (understanding) 1

As list increases in size the maximum number of comparisons increases at the

same rate;

A. in the worst case, n comparisons will be needed

NE. n comparisons are needed

01 5 Mark is for AO1 (understanding) 1

As list increases in size the maximum number of comparisons increases at a

decreasing rate;

Each comparison halves the number of remaining items that need to be considered

// each comparison halves the size of the list that has to still be searched through;

01 6 Mark is for AO1 (understanding) 1

– A-LEVEL COMPUTER SCIENCE – –

Can be used on unsorted lists;

01 7 Mark is for AO1 (understanding) 1

Both have polynomial (or better) time complexity;

Neither have exponential (or worse) time complexity;

As the size of the list grows, the increase in the time taken is reasonable;

Max 1

01 8 Mark is for AO2 (apply) 1

99;

How to answer it

Data Structures & Complexity: Hash Tables, Searching & Sorting

📌 What this question tests

This question examines core knowledge of hash tables (direct addressing, record insertion, collision generation and resolution), time complexity of searching algorithms (linear vs. binary search in Big-O notation), practical advantages of searching methods, algorithm tractability, and the operational mechanics of bubble sort.

Question 01.1 • 1 Mark

Direct Access in Hash Tables vs. Sorted Lists

Explain why a record in a hash table can normally be found more quickly than a record in a sorted list.

✅ Acceptable Answers (Any 1)

  • The hashing algorithm/function calculates/determines the exact memory location/index used directly.
  • There is no need to search through or compare other records to find the required item (direct access / O(1) lookup).

🧠 Exam Technique

Highlight the contrast: sorted lists require sequential or divide-and-conquer comparisons (e.g. O(log n)), whereas a hash table uses key computation to jump directly to the slot without comparisons.

Mark allocation: 1 mark (AO1 understanding) for identifying direct address calculation via the hash function or eliminating the need for search comparisons.
Question 01.2 • 4 Marks

Insertion Procedure in a Hash Table

Describe the steps involved in adding a new record to a hash table.

✅ 4-Step Process (1 mark per step)

  1. Apply the hashing algorithm/function;
  2. Apply it specifically to the unique/primary key of the record;
  3. Insert/store the data at the calculated index (or address/memory location);
  4. If the slot is already occupied (a collision), use a suitable method for collision handling (e.g., linear probing or rehashing).

❌ Common Errors

  • Vague input: Saying "hash the data" instead of "hash the key / primary key" scores 0 for step 2.
  • Omitting collision handling: Forgetting to describe what happens when a target slot is already filled.
Mark allocation: 4 marks (AO1 understanding). Precise sequential terminology is essential: function → key → index insertion → collision resolution.
Question 01.3 • 1 Mark

High Load Factor & Retrieval Degradation

Explain why the time taken to find a specific record in a hash table can increase when lots of records are stored in the table.

✅ Acceptable Answers

  • More collisions occur, meaning direct access will not happen as frequently / items will not be located at their initial hashed index.
  • More collisions require collision resolution methods (such as linear probing/searching through synonym chains), which takes extra time.

❌ Examiner Pitfall

Writing only "more collisions occur" is Not Enough (NE). You must state the consequence: direct addressing fails, requiring searching/probing along collision paths.

Mark allocation: 1 mark (AO1 understanding). Must explain the operational consequence of having more collisions.
Question 01.4 • 1 Mark

Time Complexity of Linear Search: O(n)

Explain why the linear search algorithm has time complexity of O(n).

✅ Acceptable Answers

  • As the list increases in size, the maximum number of comparisons increases at the same rate (direct linear proportion).
  • In the worst case, all n items must be examined/compared.

❌ Common Error

Stating simply "it takes n comparisons" is Not Enough (NE). You must qualify this as the worst-case scenario or explain the proportional growth rate.

Mark allocation: 1 mark (AO1 understanding).
Question 01.5 • 1 Mark

Time Complexity of Binary Search: O(log n)

Explain why the binary search algorithm has time complexity of O(log n).

✅ Acceptable Answers

  • Each comparison halves the number of remaining items that need to be considered (or halves the remaining search space).
  • As list size increases, the maximum number of comparisons increases at a decreasing rate (logarithmic growth).

💡 Key Knowledge

Because the search space is divided by 2 after each probe (repeated division), the number of steps required to reduce n items to 1 is log₂ n .

Mark allocation: 1 mark (AO1 understanding). Focus on the halving mechanism.
Question 01.6 • 1 Mark

Advantage of Linear Search over Binary Search

State one advantage of a linear search compared to a binary search.

✅ Accepted Answer

It can be used on unsorted / unordered lists (data does not need to be sorted prior to searching).

🧠 Exam Technique

Binary search strictly requires pre-sorted data. Sorting an unsorted list takes at best O(n log n), making a one-off linear search (O(n)) far more efficient when data is unordered.

Mark allocation: 1 mark (AO1 understanding).
Question 01.7 • 1 Mark

Tractable Algorithms

Explain why both these sorting algorithms are tractable.

✅ Acceptable Answers (Any 1)

  • Both have polynomial (or better) time complexity (e.g. O(n²) for bubble sort, O(n log n) for merge sort).
  • Neither has exponential (or factorial) time complexity.
  • As the size of the list grows, the increase in time taken is reasonable / solvable in polynomial time.

💡 Key Term: Tractability

A problem/algorithm is tractable if it can be solved within polynomial time, O(nᵏ) for some constant k . Intractable algorithms require exponential (e.g. O(2ⁿ) ) or factorial time.

Mark allocation: 1 mark (AO1 understanding).
Question 01.8 • 1 Mark

Bubble Sort Worst-Case Passes

After how many passes is bubble sort guaranteed to have sorted any list of 100 items?

📐 Calculation Steps

  1. Let the number of items be n = 100 .
  2. In each pass through the list, at least one item (the largest unsorted value) bubbles to its final correct position.
  3. Once n - 1 items are placed in their correct positions, the final 1 item is naturally positioned correctly.
  4. Number of passes = n - 1 = 100 - 1 = 99 .

✅ Final Answer

99

❌ Common Error

Answering 100. Remember that a list of n elements requires at most n - 1 complete passes.

Mark allocation: 1 mark (AO2 apply). Strictly the integer 99.

Topics

4.2 Fundamentals of data structures · 4.3 Fundamentals of algorithms · 4.4 Theory of computation · 4.2.6 Hash tables · 4.3.4 Searching algorithms · 4.3.5 Sorting algorithms · 4.4.4 Classification of algorithms

Question and mark scheme from the AQA A-Level Computer Science examination, Paper 1, June 2025. QuestionVault is an independent revision resource; questions remain the copyright of the awarding body.