You are viewing a single comment's thread. Return to all comments →
def runningTime(arr): res = 0 for i in range(1, len(arr)): j = i - 1 k = arr[i] while arr[j] > k and j>=0: arr[j+1] = arr[j] j-=1 res += 1 arr[j+1] = k return res
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 →