What is the running time of insertion sort if every item in the input array is, say, at most 10 positions out of place?
I know insertion sort is where you compare the adjacent elements starting from the first element and swap it if the latter element is bigger until it is all sorted, and the worst case is n2. However, I am not sure how to approach the case where each element is near the correct position to begin with.