The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2016 Set 1 · Q13
Time
Select one answerSingle correct
Solution
Official answer: D) (n2), (nlog n), and (n2)
Searching, Sorting and HashingThe worst-case time complexities of the three sorting algorithms are:
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 time.
Merge Sort: Merge sort divides the array into two halves, recursively sorts them, and merges them in linear time. Its recurrence relation is , which solves to in the worst, best, and average cases.
Quick Sort: When the pivot selection consistently produces the most unbalanced partitions (e.g., and elements at each step, such as on an already sorted array with the first/last element as pivot), the recurrence becomes , giving a worst-case time of .
Thus, the respective worst-case running times are , , and .
Hence, the correct option is (D).
Try the question first, then check your work.
Examiner trap
Consider the recurrence relations and worst-case input configurations (such as reverse-sorted or unbalanced pivot splits) for each algorithm.
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
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.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
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 HashingIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.