We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Running Time of Algorithms
Running Time of Algorithms
Sort by
recency
|
270 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can watch the explanation here : https://youtu.be/pAWOIEQemtc
java8
My C code 😎😁
Python3
` 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
`