A beginner's guide to insertion sort
- This algorithm works by comparing the values on the right of the array to the left of it, then swap them.
- O(n^2), because it traverses the array with every selected value, sometimes O(n) if the array is almost sorted.
- A stable algorithm, it places the duplicate numbers in the order they were at in the original array.
- In-place algorithm, does not need extra memory.