Insertion sort is a simple sorting algorithm that helps organise a list of items, like numbers or words, in a specific order, such as from smallest to largest. Imagine you have a number of cards, and you want to arrange them in order. You start with the first card, and then you pick up the next one. If the second card belongs before the first, you swap them. You continue doing this for each new card, finding the right spot in the already sorted section and inserting it there. As you go through the entire list, the items slowly become sorted. Although insertion sort is not the fastest way to sort big lists, it’s easy to understand and works well for small or mostly sorted lists.
Only required for OCR Computer Science (J277)
Examiner-written GCSE Computer Science revision resources that improve your grades 2x
- Written by expert teachers and examiners
- Aligned to exam specifications
- Everything you need to know, and nothing you don’t

Share this article