Learn
Bubble Sort: Conceptual
Bubble Sort Review
Bubble sort is an algorithm to sort a list through repeated swaps of adjacent elements. It has a runtime of O(n^2)
.
For nearly sorted lists, bubble sort performs relatively few operations since it only performs a swap when elements are out of order.
Bubble sort is a good introductory algorithm which opens the door to learning more complex algorithms. It answers the question, “How can we algorithmically sort a list?” and encourages us to ask, “How can we improve this sorting algorithm?”
Instructions
Does bubble sort have to sort in ascending order?