August 2024
Beginner
216 pages
5h 24m
English
Bubble Sort compares all the element one by one and sort them based on their values. Take the list:
21, 6, 2, 15
If we want to bubble sort this list into ascending order, we start by comparing the first number with the second number.

If the first number is greater than the second number, we swap the numbers.

Repeat the process with the second, third, and forth element, until you get to the end of the list.
Then we go through the list again and repeat the process. You’ll need to go through the list as many times as it takes until they’re ...
Read now
Unlock full access