What is the running time of QUICKSORT when all elements of array A have the same value?
The running time if all elements in a array same is similar to wrost case running running because i will be incremented to n-1 for first iteration so the recuurence will be $$T(n) = T(n-1)+\theta(n)$$ refer 7.2-1 $$T(n) = \theta(n^2)$$
No comments:
Post a Comment