use in-place insertion sort