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