levo

Recursion, Sorting and Searching

Quicksort and merge sort

  • 3 things to know
  • A2 Unit 3
Start revising · £5/month

Overview

Recall questions on the pivot and partitioning worked on a list, the base case, why the choice of pivot decides the worst case, the median-of-three, how two ordered lists are merged, the levels of merging, why merge sort is O(n log n) even at worst, and which suits a file too large for memory.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

On what principle does quicksort work?

Key term

What is the pivot in quicksort?

Key term

The list 7, 2, 9, 4, 1, 8, 5 is partitioned about the pivot 5. Which values end up on each side of it?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    On what principle does quicksort work?

    Model answer

    Quicksort chooses a pivot value, partitions the list so that smaller values lie on one side of it and larger values on the other, then sorts each side by the same method.

  2. 2

    What is the pivot in quicksort?

    Model answer

    The pivot is the value the list is partitioned about, and it finishes the partition already in its final sorted position.

  3. 3

    The list 7, 2, 9, 4, 1, 8, 5 is partitioned about the pivot 5. Which values end up on each side of it?

    Model answer

    The values 2, 4 and 1 finish on the left of 5 and the values 7, 9 and 8 finish on its right.

  4. 4

    How does quicksort know when to stop calling itself?

    Model answer

    A sublist holding one item, or none at all, is already in order, so it is returned without being partitioned any further.

  5. 5

    Why is quicksort described as a divide-and-conquer algorithm?

    Model answer

    Each partition divides the task into two smaller sorting tasks that are solved by the same algorithm, and no work at all is needed to join the results.

  6. 6

    Under what circumstances does quicksort perform at its worst, and what does its running time become?

    Model answer

    It performs worst when every pivot turns out to be the smallest or largest value remaining, so one side of each partition is empty and the time rises to O(n²).

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Hardware: Architecture, Memory and Storage
Networks and Data Transmission
Logic Gates and Boolean Algebra
Data Representation and Data Types

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

Fetch, , execute.
decodecompilestore

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

A bit is a single binary digit.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Recursion, Sorting and Searching, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.