+1 vote
in Data Structures & Algorithms II by (110k points)
What is the purpose of using a median of three quick sort over standard quick sort?

(a) so as to avoid worst case time complexity

(b) so as to avoid worst case space complexity

(c) to improve accuracy of output

(d) to improve average case time complexity

I have been asked this question in an interview.

This is a very interesting question from Sorting topic in portion Sorting of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
 
Best answer
Correct option is (a) so as to avoid worst case time complexity

The best I can explain: Median of three quick sort helps in avoiding the worst case time complexity of O(n^2) which occurs in case when the input array is already sorted. However, the average case and best case time complexities remain unaltered.

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.

Categories

...