Insertion sort algorithm implementation.