Match the algorithms with their time complexities:
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2017 Set 2 · Q3
Time

Select one answerSingle correct
Solution
Official answer: C) P → (iii), Q → (iv), R → (ii), S → (i)
Asymptotic AnalysisLet us match each algorithm to its time complexity:
(P) Towers of Hanoi with disks: The recurrence relation for Towers of Hanoi is , which gives . Thus, P (iii).
(Q) Binary search given sorted numbers: Binary search divides the search space in half at each step, yielding a recurrence , so the time complexity is . Thus, Q (iv).
(R) Heap sort given numbers at the worst case: Heap sort takes to build the heap and performs extractions each taking , leading to a worst-case time complexity of . Thus, R (ii).
(S) Addition of two matrices: Adding two matrices of size requires performing element-wise addition for all elements, giving a time complexity of . Thus, S (i).
Matching combination: P (iii), Q (iv), R (ii), S (i), which corresponds to option C.
Try the question first, then check your work.
Examiner trap
Recall the classic recurrence relations: Towers of Hanoi has exponential complexity , binary search is logarithmic, heap sort is , and traversing an matrix is quadratic.
This Asymptotic Analysis previous year question is Q3 of the GATE CSE 2017 Set 2 paper. Find more GATE CSE PYQs on Asymptotic Analysis 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 Asymptotic Analysis 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.
Asymptotic Analysis has 31 GATE CSE PYQs across 19 papers from 2011 to 2026. 15 of them are 1-mark MCQs like this one, and GATE CSE 2017 Set 2 has 3.
How GATE tests Asymptotic AnalysisIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.