In-place, stable and online quadratic-complexity sort algorithm useful for small
data-set.
Approach: Given a list, take the current element and insert it at
the appropriate position of the list, adjusting the list every time you insert. It is similar to
arranging the cards in a Card game.
Usage: Typical implementations of the
general-purpose quick/merge-sort also switch to insertion-sort for small data-sets.
Insertion
Sort an adaptive algorithm i.e. efficient for data sets already sorted to some degree.
Inner Loop: operates on the Sorted portion.
Reference