Bubble sort: Difference between revisions
Jump to navigation
Jump to search
m Savoundg moved page Bubblesort to Bubble sort |
No edit summary |
||
| Line 6: | Line 6: | ||
This algorithm should only be used on almost sorted array (that implies few permutations). | This algorithm should only be used on almost sorted array (that implies few permutations). | ||
This algorithm has one advantage in its ability to tell if an array is already sorted in O(n). | |||
== Resources == | == Resources == | ||
Revision as of 02:30, 4 June 2018
Bubble sort is the simplest exchange sorting algorithm.
Each element of the array is compared (and swapped if bigger) with every other element of the array.
The worst-case and average complexity is O(n2).
This algorithm should only be used on almost sorted array (that implies few permutations).
This algorithm has one advantage in its ability to tell if an array is already sorted in O(n).
Resources
| https://en.wikipedia.org/wiki/Bubble_sort |