Quicksort using Random Sampling Multiple choice Questions and Answers (MCQs)
Click on any option to know the CORRECT ANSWERS
Quick sort uses which of the following algorithm to implement sorting?
divide and conquer
Question 1 Explanation:
Quick sort uses the technique of divide and conquer in order to sort a given array. It divides the array into two parts about the pivot and then apply a quick sort to both the parts.
What is a randomized quick sort?
quick sort with random partitions
quick sort with random choice of pivot
quick sort with random output
quick sort with random input
Question 2 Explanation:
Randomized quick sort chooses a random element as a pivot. It is done so as to avoid the worst case of quick sort in which the input array is already sorted.
What is the purpose of using randomized quick sort over standard quick sort?
so as to avoid worst case time complexity
so as to avoid worst case space complexity
to improve accuracy of output
to improve average case time complexity
Question 3 Explanation:
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.
What is the auxiliary space complexity of randomized quick sort?
O(n log n)
Question 4 Explanation:
Auxiliary space complexity of randomized quick sort is O(log n) which is used for storing call stack formed due to recursion. Note that the algorithms with space complexity as O(log n) also qualifies as in place algorithms as the value of log n is close to 1.
What is the average time complexity of randomized quick sort?
O(n log n)
O(n2 log n)
O(n log n2)
Question 5 Explanation:
The average case time complexity of randomized quick sort is same as that of standard quick sort as randomized quick sort only helps in preventing the worst case. It is equal to O(n log n).
There are 5 questions to complete.