# Quicksort using Random Sampling Multiple choice Questions and Answers (MCQs)

## Quicksort using Random Sampling Multiple choice Questions and Answers (MCQs)

 Question 1
Quick sort uses which of the following algorithm to implement sorting?
 A backtracking B greedy algorithm C divide and conquer D dynamic programming
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.

 Question 2
What is a randomized quick sort?
 A quick sort with random partitions B quick sort with random choice of pivot C quick sort with random output D 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.

 Question 3
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 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.

 Question 4
What is the auxiliary space complexity of randomized quick sort?
 A O(1) B O(n) C O(log n) D O(n log n)