Implement insertion sort algorithm