+1 vote
in Data Structures & Algorithms II by (110k points)
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

1 Answer

+1 vote
by (614k points)
selected by
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.