- Already sorted, such as [1, 2, 3, 4]: every key is already in the right place, so nothing shifts. This is the quickest case.
- Nearly sorted, such as [2, 3, 4, 1]: only the last key has to move, but it shifts three items.
- Reverse order, such as [4, 3, 2, 1]: every key shifts past every item in the sorted part. This is the slowest case, with 6 shifts for 4 items.
This study notes covers Deep Dive: Best and Worst Lists within Insertion Sort for GCSE Computer Science. Revise Insertion Sort in 3.1 Fundamentals of Algorithms for GCSE Computer Science with 15 exam-style questions and 10 flashcards. This topic appears regularly enough that it should still be part of a steady revision cycle. It is section 4 of 7 in this topic. Use this study notes to connect the idea to the wider topic before moving on to questions and flashcards.
Practice questions for Insertion Sort
Which statement best describes how insertion sort works?
Describe how insertion sort works. Your answer should include how the algorithm processes each element.