GateAI
Asymptotic Analysis

GATE CSE 2017 Set 2 · Q3

MCQ1 markEasy

Time

Match the algorithms with their time complexities:

GATE CSE 2017 Set 2 Q3 diagram

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) P → (iii), Q → (iv), R → (ii), S → (i)

Asymptotic Analysis

Let us match each algorithm to its time complexity:

  • (P) Towers of Hanoi with nn disks: The recurrence relation for Towers of Hanoi is T(n)=2T(n−1)+1T(n) = 2T(n-1) + 1, which gives T(n)=2n−1=Θ(2n)T(n) = 2^n - 1 = \Theta(2^n). Thus, P →\rightarrow (iii).

  • (Q) Binary search given nn sorted numbers: Binary search divides the search space in half at each step, yielding a recurrence T(n)=T(n/2)+O(1)T(n) = T(n/2) + O(1), so the time complexity is Θ(log⁡n)\Theta(\log n). Thus, Q →\rightarrow (iv).

  • (R) Heap sort given nn numbers at the worst case: Heap sort takes O(n)O(n) to build the heap and performs nn extractions each taking O(log⁡n)O(\log n), leading to a worst-case time complexity of Θ(nlog⁡n)\Theta(n \log n). Thus, R →\rightarrow (ii).

  • (S) Addition of two n×nn \times n matrices: Adding two matrices of size n×nn \times n requires performing element-wise addition for all n2n^2 elements, giving a time complexity of Θ(n2)\Theta(n^2). Thus, S →\rightarrow (i).

Matching combination: P →\rightarrow (iii), Q →\rightarrow (iv), R →\rightarrow (ii), S →\rightarrow (i), which corresponds to option C.

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 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

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 Asymptotic Analysis 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.

Asymptotic Analysis in GATE CSE

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 Analysis

More from GATE CSE 2017 Set 2

Share this solution

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

GateAI solution cardGATE CSE 2017 Set 2 · Q3 · MCQ

Match the algorithms with their time complexities:

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.