• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on QuickSort Algorithm with Answers

Question 1

What is recurrence for worst case of QuickSort and what is the time complexity in Worst case?
  • Recurrence is T(n) = T(n-2) + O(n) and time complexity is O(n^2)
  • Recurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)
  • Recurrence is T(n) = 2T(n/2) + O(n) and time complexity is O(nLogn)
  • Recurrence is T(n) = T(n/10) + T(9n/10) + O(n) and time complexity is O(nLogn)

Question 2

Suppose we have an O(n) time algorithm that finds the median of an unsorted array. Now consider a QuickSort implementation where we first find the median using the above algorithm, then use the median as a pivot. What will be the worst-case time complexity of this modified QuickSort?

  • O(n^2 Logn)

  • O(n^2)

  • O(n Logn Logn)

  • O(nLogn)

Question 3

Which of the following is not a stable sorting algorithm in its typical implementation.

  • Insertion Sort

  • Merge Sort

  • Quick Sort

  • Bubble Sort

Question 4

Which of the following sorting algorithms in its typical implementation gives best performance when applied on an array which is sorted or almost sorted (maximum 1 or two elements are misplaced).

  • Quick Sort

  • Heap Sort

  • Merge Sort

  • Insertion Sort

Question 5

Given an unsorted array. The array has this property that every element in the array is at most k distance from its position in a sorted array where k is a positive integer smaller than the size of an array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity?

  • Insertion Sort with time complexity O(kn)

  • Heap Sort with time complexity O(nLogk)

  • Quick Sort with time complexity O(kLogk)

  • Merge Sort with time complexity O(kLogk)

Question 6

Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this:
2  5  1  7  9  12  11  10 

Which statement is correct?
  • The pivot could be either the 7 or the 9.
  • The pivot could be the 7, but it is not the 9
  • The pivot is not the 7, but it could be the 9
  • Neither the 7 nor the 9 is the pivot.

Question 7

You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate?
  • Heap sort
  • Merge sort
  • Quick sort
  • Insertion sort

Question 8

In quick sort, for sorting n elements, the (n/4)th smallest element is selected as a pivot using an O(n) time algorithm. What is the worst-case time complexity of the quick sort?

(A) [Tex]\\theta [/Tex](n)

(B) [Tex]\\theta [/Tex](n*log(n))

(C) [Tex]\\theta [/Tex](n2)

(D) [Tex]\\theta [/Tex](n2 log n)

  • A

  • B

  • C

  • D

Question 9

Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element that splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then

  • T(n) <= 2T(n/5) + n

  • T(n) <= T(n/5) + T(4n/5) + n

  • T(n) <= 2T(4n/5) + n

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

Question 10

Which sorting algorithms is most efficient to sort string consisting of ASCII characters?
  • Quick sort
  • Heap sort
  • Merge sort
  • Counting sort

There are 28 questions to complete.

Last Updated :
Take a part in the ongoing discussion