Insertion Sort

Insertion sort is an efficient algorithm for sorting a small number of elements. Insertion sort sorts the array by shifting elements one by one. Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain.

Click here for Insertion sort algorithm with examples in C & Java