Insertion sort’s worst case performance is О(n
2
). To sort a list, it uses comparisons and swaps.
Even, it has quadratic time complexity, it is more efficient than other quadratic and simple
algorithms like selection sort or bubble sort. Also, for nearly sorted lists, its time complexity
is O(n).
Insertion sort is a stable sorting algorithm. Also, it sorts the lists in-place. Thus, Insertion
sort’s memory requirement is only O(1).