Insertion Sort #
Insertion sort is one of many sorting algorithms used to sort data in different data structures.
Each sorting algorithm has its own advantages and disadvantages. Insertion sort is no exception. It is a simple algorithm that is easy to implement and understand. However, it is not the most efficient sorting algorithm when it comes to large data sets.
Concept #

Complexity and Stability #
| Case | Time Complexity | Space Complexity | Stable |
|---|---|---|---|
| Best Case | O(n) | O(1) | Yes |
| Average Case | O(n^2) | O(1) | Yes |
| Worst Case | O(n^2) | O(1) | Yes |
| Space | O(1) | O(1) | Yes |