1.

What is the worst case time complexity of the Quick sort?(a) O(nlogn)(b) O(n)(c) O(n^3)(d) O(n^2)The question was posed to me in an interview.My doubt is from Quicksort topic in division Sorting of Data Structures & Algorithms II

Answer»

The correct answer is (d) O(N^2)

Easy explanation - The worst case running TIME for QUICK sort is O(n^2). In Quick sort, the worst case behaviour occurs when the partitioning routine produces two sub-arrays one with n – 1 ELEMENT and other with 0 elements.



Discussion

No Comment Found

Related InterviewSolutions