# YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

## Quicksort Multiple choice Questions and Answers (MCQs)

Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

Quick sort is a .....

greedy algorithm | |

divide and conquer algorithm | |

dynamic programming algorithm | |

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?

O(nlogn) | |

O(n) | |

O(n ^{3}) | |

O(n ^{2}) |

Question 2 Explanation:

The worst case running time for Quick sort is O(n

^{2}). 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?

6 4 3 7 11 9 14 12 | |

6 3 4 7 9 14 11 12 | |

7 6 14 11 9 4 3 12 | |

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

n/2 : (n/2) - 1 | |

n/2 : n/3 | |

n/4 : 3n/2 | |

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.

True | |

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.