InterviewSolution
Saved Bookmarks
| 1. |
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 complexityI 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 |
|
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. |
|