| Feature | Bubble Sort |
|---|---|
| Method | Compare neighbouring items, swap if in the wrong order, repeat passes |
| After each pass | The largest unsorted value is in its final place at the end |
| Stops when | A full pass makes no swaps |
| Maximum passes | n - 1 passes that make swaps, for a list of n items |
| Extra memory | None: it sorts in place, without a second list |
| Advantage | Simple to understand and to program |
| Disadvantage | Slow on large lists because of the many comparisons and swaps |
This study notes covers Bubble Sort at a Glance within Bubble Sort for GCSE Computer Science. Revise Bubble Sort in 3.1 Fundamentals of Algorithms for GCSE Computer Science with 16 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 2 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 Bubble Sort
Which of the following best describes bubble sort?
Describe how bubble sort works. You should refer to what happens during each pass through the list. [3 marks]