Insertion sort is a simple sorting algorithm that works similar to the way you sort playing cards in your hands. The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed at the correct position in the sorted part. It is an in-place algorithm and is stable in nature. The insertion sort is used when the array is has a small number of elements or when there are only a few elements left to be sorted.