Insertion Sort
Insertion Sort For absolute Beginners
Insertion Sort is a simple sorting algorithm that builds the final sorted array one item at a time. It is much like sorting playing cards in your hands.
See it in action
5
8
8
4
1
3
3
3
8
9
Time Complexity
- Best Case: O(n)
- Average Case: O(n^2)
- Worst Case: O(n^2)
Space Complexity
- O(1)