GCSE Computer Science (OCR)

Topic Summaries

ALGORITHMS AND PROGRAMMING: Computational thinking

Sorting algorithms

  Method Use case Example
Bubble sort Repeatedly compare and swap adjacent elements until the list is sorted Small or nearly sorted lists

[4, 2, 3]

→ compare 4 & 2

→ swap

→ [2, 4, 3]

→ swap 4 & 3

→ [2, 3, 4]

Merge sort Split the list in half until each part has one element, then merge pairs back together in order Large lists needing efficient sorting

[6, 3, 9, 1]

→ split

→ merge sorted halves

→ [1, 3, 6, 9]

Insertion sort Build the sorted list one element at a time by placing each element in the correct position Small or nearly sorted lists

[4, 2, 5]

→ Insert 2 before 4

→ [2, 4]

→ Insert 5 after 4

→ [2, 4, 5]

Unlock Sorting algorithms

Sign up to unlock the rest of this topic — plus every other topic, video, flashcard set and eBook guide in your SnapRevise Digital subscription.

Cancel anytime — instant access the moment you sign up.