• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on QuickSort Algorithm with Answers

Question 21

Which of the following changes to typical QuickSort improves its performance on average and are generally done in practice.

1) Randomly picking up to make worst case less 
   likely to occur.
2) Calling insertion sort for small sized arrays 
   to reduce recursive calls.
3) QuickSort is tail recursive, so tail call 
   optimizations can be done.
4) A linear time median searching algorithm is used 
   to pick the median, so that the worst case time 
   reduces to O(nLogn)
  • 1 and 2

  • 2, 3, and 4

  • 1, 2 and 3

  • 2, 3 and 4

Question 22

Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting n(≥ 2) numbers? In the recurrence equations given in the options below, c is a constant.

  • T(n) = 2T (n/2) + cn

  • T(n) = T(n – 1) + T(0) + cn

  • T(n) = 2T (n – 2) + cn

  • T(n) = T(n/2) + cn

Question 23

Consider a list of recursive algorithms and a list of recurrence relations as shown below. Each recurrence relation corresponds to exactly one algorithm and is used to derive the time complexity of the algorithm.
Recursive Algorithm Recurrence Relation
P. Binary search I. T(n) = T(n-k) + T(k) + cn
Q. Merge sort II. T(n) = 2T(n-1) + 1
R. Quick sort III. T(n) = 2T(n/2) + cn
S. Tower of Hanoi IV. T(n) = T(n/2) + 1
  • P-II, Q-III, R-IV, S-I
  • P-IV, Q-III, R-I, S-II
  • P-III, Q-II, R-IV, S-I
  • P-IV, Q-II, R-I, S-III

Question 24

Which of the following sorting algorithms has the minimum running time complexity in the best and average case?
  • Insertion sort, Quick sort
  • Quick sort, Quick sort
  • Quick sort, Insertion sort
  • Insertion sort, Insertion sort

Question 25

Which is the correct order of the following algorithms with respect to their time Complexity in the best case ?
  • Merge sort > Quick sort >Insertion sort > selection sort
  • insertion sort < Quick sort < Merge sort < selection sort
  • Merge sort > selection sort > quick sort > insertion sort
  • Merge sort > Quick sort > selection sort > insertion sort

Question 26

What is the best sorting algorithm to use for the elements in array are more than 1 million in general?
  • Merge sort.
  • Bubble sort.
  • Quick sort.
  • Insertion sort.

Question 27

Quicksort is run on two inputs shown below to sort in ascending order taking the first element as pivot,

(i) 1, 2, 3,......., n
(ii) n, n-1, n-2,......, 2, 1 

Let C1 and C2 be the number of comparisons made for the inputs (i) and (ii) respectively. Then,

  • C1 < C2 
     

  • C1 > C2

  • C1 = C2

  • We cannot say anything for arbitrary n

Question 28

Quick sort is run on 2 inputs shown below to sort in ascending order

A. 1, 2, 3……n
B. n, n – 1, n – 2 …… 1

Let C1 and C2 be the number of comparisons made for A and B respectively. Then

  • C1 > C2

  • C1 = C2

  • C1 < C2 
     

  • Cannot say anything for arbitrary n

There are 28 questions to complete.

Last Updated :
Take a part in the ongoing discussion