The sorting algorithms we already know!

SortDescriptionWorst Case
BubbleCompare two elements at a time and swap if the second element is larger than the first. Repeat until sorted.$O(n^2)$
SelectionFind largest, swap with last element then, find the second largest, swap with the second last element and so on (repeat for each position).$O(n^2)$
InsertionDivide the sequence into sorted and unsorted portions. The sorted portion is empty at start. Remove the first element from unsorted and place it into the sorted portion such that it remains sorted. Repeat until the unsorted portion is empty.$O(n^2)$
HeapBuild a max-heap from the sequence (bottom-up heapify). Remove the max and swap it to the end of the collection where the "leaf" was removed. Repeat the last step $n-1$ times.$O(n \lg n)$