Insertion sort
easyLift each value out, slide the larger ones right, drop it into the gap. On nearly-sorted input the inner loop barely runs - which is why real library sorts fall back to it for small or partly-ordered runs.
Best
O(n)Average O(n²)Worst O(n²)Space O(1)StableIn placeLoading the insertion sort engine…