You are viewing a single comment's thread. Return to all comments →
def runningTime(arr): shifts = 0 for i in range(1,len(arr)): j = i while j >= 1 and arr[j] < arr[j-1]: shifts += 1 arr[j], arr[j-1] = arr[j-1], arr[j] j -= 1 return shifts
Seems like cookies are disabled on this browser, please enable them to open this website
Running Time of Algorithms
You are viewing a single comment's thread. Return to all comments →