Bubble Sort
Wikipedia on bubble sort.
Algorithm
A bubble sort is a sorting algorithm with a Big O complexity of O(n**2). It is called bubble sort, because the small numbers "bubble" to the top of the list.
The general flow is to step through the list, continually comparing pairs of numbers. If the number on the left is larger than the number on the right, swap them and continue.
Implementation
Write a function, bubble_sort()
, that takes an list
. It should return a sorted list
, using the bubble sort algorithm.