in big O notation:
O(n) - ideal linear behavior O(n log n) - good behavior O(n^2) - bad behavior
- Compare each pair elements.
- Swap them if 1st is greater than 2nd.
- After last pair, repeat from beginning until no swaps have occured in the last pass.
- Find the minimum value
- Swapt it with the value in the first position
- Repeat for the rest of the list
O(n log n)
- Select the median value (pivot)
- Move all values smaller than the pivot before it
- Recursively sort the lesser and greater sublists