GateAI
Searching, Sorting and Hashing

GATE CSE 2016 Set 1 · Q13

MCQ1 markEasy

Time

The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: D) (n2), (nlog n), and (n2)

Searching, Sorting and Hashing

The worst-case time complexities of the three sorting algorithms are:

  1. Insertion Sort: When the input array is sorted in reverse order, each element has to be compared and shifted across the entire sorted subarray, leading to ∑i=1n−1i=Θ(n2)\sum_{i=1}^{n-1} i = \Theta(n^2) time.

  2. Merge Sort: Merge sort divides the array into two halves, recursively sorts them, and merges them in linear time. Its recurrence relation is T(n)=2T(n/2)+Θ(n)T(n) = 2T(n/2) + \Theta(n), which solves to Θ(nlog⁡n)\Theta(n\log n) in the worst, best, and average cases.

  3. Quick Sort: When the pivot selection consistently produces the most unbalanced partitions (e.g., 00 and n−1n-1 elements at each step, such as on an already sorted array with the first/last element as pivot), the recurrence becomes T(n)=T(n−1)+Θ(n)T(n) = T(n-1) + \Theta(n), giving a worst-case time of Θ(n2)\Theta(n^2).

Thus, the respective worst-case running times are Θ(n2)\Theta(n^2), Θ(nlog⁡n)\Theta(n\log n), and Θ(n2)\Theta(n^2).

Hence, the correct option is (D).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Searching, Sorting and Hashing previous year question is Q13 of the GATE CSE 2016 Set 1 paper. Find more GATE CSE PYQs on Searching, Sorting and Hashing in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Searching, Sorting and Hashing PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Searching, Sorting and Hashing in GATE CSE

Searching, Sorting and Hashing has 27 GATE CSE PYQs across 20 papers from 2012 to 2026. 9 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2016 Set 1.

How GATE tests Searching, Sorting and Hashing

More from GATE CSE 2016 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2016 Set 1 · Q13 · MCQ

The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.