# Quicksort Multiple choice Questions and Answers (MCQs)

## Quicksort Multiple choice Questions and Answers (MCQs)

 Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Quick sort is a .....
 A greedy algorithm B divide and conquer algorithm C dynamic programming algorithm D backtracking algorithm
Question 1 Explanation:
Quick sort is a divide and conquer algorithm. Quick sort first partitions a large array into two smaller sub-arrays. And then recursively sorts the sub-arrays.

 Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the worst case time complexity of the Quick sort?
 A O(nlogn) B O(n) C O(n3) D O(n2)
Question 2 Explanation:
The worst case running time for Quick sort is O(n2). In Quick sort, the worst case behaviour occurs when the partitioning routine produces two sub-arrays one with n - 1 element and other with 0 elements.

 Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Apply Quick sort on a given sequence 7 11 14 6 9 4 3 12. What is the sequence after first phase, pivot is first element?
 A 6 4 3 7 11 9 14 12 B 6 3 4 7 9 14 11 12 C 7 6 14 11 9 4 3 12 D 7 6 4 3 9 14 11 12
Question 3 Explanation:
Let's apply Quick sort on the given sequence,

For first phase, pivot = 7

7 11 14 6 9 4 3 12

i j

7 11 14 6 9 4 3 12

i j

7 3 14 6 9 4 11 12

i j

7 3 4 6 9 14 11 12

i j

7 3 4 6 9 14 11 12

j i

6 3 4 7 9 14 11 12

 Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The best case behaviour occurs for quick sort is, if partition splits the array of size n into .....
 A n/2 : (n/2) - 1 B n/2 : n/3 C n/4 : 3n/2 D n/4 : 3n/4
Question 4 Explanation:
The best case analysis of quick sort occurs when the partition splits the array into two subarrays, each of size no more than n/2 since one is of size n/2 and one of size (n/2) - 1.

 Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Quick sort is a stable sorting algorithm.
 A True B False
Question 5 Explanation:
In stable sorting algorithm the records with equal keys appear in the same order in the sorted sequence as they appear in the input unsorted sequence. Quick sort does not preserve the relative order of equal sort items. Therefore, Quick sort is not a stable sort.

There are 5 questions to complete.