Compare neighbours and swap them, pass after pass, until a pass makes no swaps.
One pass at a time
A bubble sort goes along the list comparing each pair of neighbours.
If a pair is in the wrong order, it swaps them. One trip along the list is a pass.
After the first pass, the largest item has "bubbled" to the end and is in its final place. So each pass can stop one place earlier than the one before.
The rest of this lesson and its 7 practice questions are in Plus.
Screen 1 of 3, free to read.
- 7 exam-style questions, marked as you go, each with a worked solution
- Anything you get wrong is saved to your flashcards