Insertion sort algorithm.