You are viewing a single comment's thread. Return to all comments →
In case, you are looking for C Solution
int runningTime(int arr_count, int* arr) { int i, j, key, c=0; for (i=1; i<arr_count; ++i) { key = arr[i]; j = i-1; while(j >= 0 && arr[j] > key) { arr[j+1]=arr[j]; j=j-1; c++; } arr[j+1]=key; } return c; }
Running Time of Algorithms
You are viewing a single comment's thread. Return to all comments →
In case, you are looking for C Solution