Community resourceWorksheet

OCR H446 2.3.1 Bubble and insertion sort

Part 6 of 16 · H446 2.3.1 · Algorithms

Bubble and insertion sort are both in-place and both examined in H446 2.3.1, yet they rest on different mental models: adjacent swaps across passes against a growing sorted partition. Keeping those models distinct is what this worksheet drills, through hand traces, implementations and a comparison on favourable and unfavourable data.

Students will:

  • say what one complete bubble pass guarantees about the data
  • show every state of an insertion sort, marking the sorted and unsorted partitions
  • trace a full bubble process including the swap flag that allows an early exit
  • implement both sorts in Python with early exit and shifting behaviour
  • compare the two on already sorted and reverse-sorted input

Inside: 5 explanation cells, 1 multiple-choice question, 1 fill-in-the-blanks cell, 2 written answers, 1 Python task and 1 trace table. 29 marks, about 30 to 45 minutes.

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

Shared by Coding PathwayVerified teacher

  • 11 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.

Bubble and insertion sort

Both sorts can be written in place, but their mental models differ: bubble makes adjacent swaps across passes; insertion grows a sorted partition.

By the end, you will be able to

  • perform both manually;
  • expose pass/partition invariants;
  • read, trace and write both algorithms;
  • compare cases and suitability.

Reactivate: swapping two values requires preserving one temporarily.

Worked model: keep insertion's partition visible

Insertion sort partition3712189520sorted partitionunsorted partitiontake 9; shift larger sorted values; insert 9 between 7 and 12

For bubble ascending, after each full pass the largest unsorted value has moved to the right. For insertion, before each insertion the left partition is sorted; take the next value, shift larger values right, then place it in the gap.

Multiple choice1 mark

After one complete ascending bubble pass, what is guaranteed?

  • AThe entire list is sorted
  • BThe largest considered value is at the right end
  • CThe smallest is in the middle
  • DNo comparisons remain
Written answer6 marks

Show every state needed to sort [5, 2, 4, 1] using insertion sort. Mark the sorted and unsorted partitions after each insertion.

Do not describe insertion as repeated full bubble passes.

Students type their answer here.

Trace table5 marks

Trace one full bubble process and its swap flag.

Enter a value only when it changes. Record output in order.

Use one row for each pass through the loop. Fill in a box only when that value changes on that row, and leave the rest blank.

ProgramPython
  1. data = [4,1,3,2]
  2. swapped = True
  3. while swapped:
  4. swapped = False
  5. for i in range(len(data)-1):
  6. if data[i] > data[i+1]:
  7. temporary = data[i]
  8. data[i] = data[i+1]
  9. data[i+1] = temporary
  10. swapped = True
  11. print(data)
Trace table with 7 columns
Rowdataswappeditemporaryswappeddata[i] > data[i+1]Output
1
2
3
4
5
6
7

Independent transfer: write both sorts

Return an ascending copy or mutate and return data. Include bubble early-exit and insertion shifting.

Coding task12 marks
def bubble_sort(data):
    pass

def insertion_sort(data):
    pass
Written answer6 marks

Compare bubble with early exit and insertion on already sorted and reverse-sorted data. Explain why naming a sorted/unsorted partition earns precision.

Link cases to comparisons and swaps/shifts.

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
Bubble sort compares completion 1 items and exchanges out-of-order pairs using completion 2. Insertion sort grows a completion 3 and moves larger values by completion 4 them before inserting the held item.

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.