1.

What is the purpose of using randomized 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 complexityThis question was addressed to me during an interview for a job.My question is from Sorting topic in portion Sorting of Data Structures & Algorithms II

Answer»

Right choice is (a) so as to AVOID worst case time complexity

To explain: RANDOMIZED quick sort helps in avoiding the worst case time complexity of O(N2) which occurs in case when the input array is ALREADY sorted. However the AVERAGE case and best case time complexities remain unaltered.



Discussion

No Comment Found

Related InterviewSolutions