Community resourceWorksheet

OCR H446 2.3.1 Quick sort

Part 8 of 16 · H446 2.3.1 · Algorithms

Quick sort answers in H446 2.3.1 are only markable when the pivot and partition convention are stated, because different conventions produce different intermediate lists. This worksheet supplies one explicit convention, works a full set of recursive partitions with it, then turns to why pivot choice decides whether the algorithm scales well or badly.

Students will:

  • apply a supplied pivot and partition convention consistently through a trace
  • show every recursive partition produced when sorting an eight-item list by hand
  • implement quick sort in Python under the stated convention
  • link balanced and repeatedly extreme pivots to the resulting growth behaviour
  • compare quick sort with merge sort on timing, pivot sensitivity and extra storage

Inside: 5 explanation cells, 1 multiple-choice question, 1 fill-in-the-blanks cell, 2 written answers and 1 Python task. 27 marks, about 25 to 40 minutes.

Series: H446 2.3.1 · Algorithms, part 8 of 16.

Shared by Coding PathwayVerified teacher

  • 10 cells
  • About 30 minutes
  • CC BY-SA 4.0
  • Shared 31 Aug 2026
  • Updated 3 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Quick sort

Quick sort selects a pivot, partitions values relative to it, then recursively sorts the partitions. A manual trace is only markable when the pivot and partition convention are stated.

By the end, you will be able to

  • apply a supplied pivot convention;
  • preserve every value during partition;
  • read, trace and write a clear quick sort;
  • relate pivot balance to best/average/worst behaviour.

Reactivate: recursion stops at partitions of length zero or one.

Worked model: one explicit convention

Quick sort partition with stated pivot convention83627154pivot = last value, 5smaller: [3, 2, 1, 4]larger/equal: [8, 6, 7]

This worksheet chooses the final value as pivot and builds smaller and larger-or-equal lists. Other correct implementations partition in place and may show different intermediate states; never mix conventions mid-trace.

Multiple choice1 mark

Why must a manual quick-sort question state a pivot convention?

  • AQuick sort has no comparisons
  • BThe pivot must be the median
  • COnly one pivot value can sort a list
  • DDifferent valid conventions create different intermediate partitions
Written answer8 marks

Using final-item pivot and stable smaller/larger-or-equal lists, show all recursive partitions for [8, 3, 6, 2, 7, 1, 5, 4].

Label every pivot and base case.

Students type their answer here.

Guided case reasoning

Balanced partitions give about log n levels with n partition work per level: O(n log n). Repeatedly choosing an extreme pivot produces one large partition and one empty partition: O(n²). State the pivot policy and input arrangement when describing a case.

Coding task8 marks
def quick_sort(data):
    pass
Written answer6 marks

Compare quick sort and merge sort for time behaviour, pivot sensitivity and auxiliary storage. Avoid claiming quick sort is always faster.

Give a qualified recommendation.

Students type their answer here.

Closed-book checkpoint

Complete each sentence from memory. There is no answer bank and correctness is held for teacher review.

Fill in the blanks4 marks
Quick sort chooses a completion 1 and compares other values with it. Dividing values around that choice is completion 2. Roughly completion 3 partitions support O(n log n) behaviour; repeated extreme choices can produce completion 4 time.

Review your understanding

Before submitting, check that you can explain the central distinction in your own words, expose the intermediate state that supports your answer and apply the method in an unfamiliar context.