GateAI
Asymptotic Analysis

GATE CSE 2021 Set 1 · Q30

MCQ2 marksMedium

Time

Consider the following recurrence relation. T(n)={T(n/2)+T(2n/5)+7nif n>01if n=0 T(n) = \begin{cases} T(n/2) + T(2n/5) + 7n & \text{if } n > 0 \\ 1 & \text{if } n = 0 \end{cases} Which one of the following options is correct?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) T(n) = (n)

Asymptotic Analysis

We can solve the recurrence using the Recursion Tree Method or the Akra-Bazzi Theorem.

### Method 1: Recursion Tree Analysis

At each level of the recursion tree, we sum the non-recursive work performed:

  • Level 0: 7n7n

  • Level 1: 7(n2)+7(2n5)=7n(12+25)=7n(910)7\left(\frac{n}{2}\right) + 7\left(\frac{2n}{5}\right) = 7n\left(\frac{1}{2} + \frac{2}{5}\right) = 7n\left(\frac{9}{10}\right)

  • Level 2:7n(910)27n\left(\frac{9}{10}\right)^2

  • Level kk:7n(910)k7n\left(\frac{9}{10}\right)^k

Summing the work across all levels:

T(n)=∑k=0∞7n(910)k=7n∑k=0∞(910)kT(n) = \sum_{k=0}^{\infty} 7n\left(\frac{9}{10}\right)^k = 7n \sum_{k=0}^{\infty} \left(\frac{9}{10}\right)^k

Since this is an infinite geometric series with common ratio r=910<1r = \frac{9}{10} < 1:

∑k=0∞(910)k=11−9/10=10\sum_{k=0}^{\infty} \left(\frac{9}{10}\right)^k = \frac{1}{1 - 9/10} = 10
T(n)=7n×10=70n=Θ(n)T(n) = 7n \times 10 = 70n = \Theta(n)

### Method 2: Akra-Bazzi Theorem

The recurrence is of the form T(n)=∑i=1kaiT(bin)+g(n)T(n) = \sum_{i=1}^k a_i T(b_i n) + g(n), where a1=1,b1=1/2a_1=1, b_1=1/2, a2=1,b2=2/5a_2=1, b_2=2/5, and g(n)=7ng(n) = 7n.

Find pp such that:

∑i=1kaibip=1  ⟹  (12)p+(25)p=1\sum_{i=1}^k a_i b_i^p = 1 \implies \left(\frac{1}{2}\right)^p + \left(\frac{2}{5}\right)^p = 1

Evaluating at p=1p = 1:

12+25=910<1\frac{1}{2} + \frac{2}{5} = \frac{9}{10} < 1

Since the sum decreases as pp increases, we must have p<1p < 1.

The solution is given by:

T(n)=Θ(np(1+∫1ng(u)up+1du))=Θ(np(1+7∫1nu−pdu))T(n) = \Theta\left(n^p \left(1 + \int_1^n \frac{g(u)}{u^{p+1}} du\right)\right) = \Theta\left(n^p \left(1 + 7\int_1^n u^{-p} du\right)\right)

Since p<1p < 1, the integral evaluates to:

∫1nu−pdu=Θ(n1−p)\int_1^n u^{-p} du = \Theta(n^{1-p})

Therefore:

T(n)=Θ(np⋅n1−p)=Θ(n)T(n) = \Theta\left(n^p \cdot n^{1-p}\right) = \Theta(n)

Hence, the correct option is (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 Q30 of the GATE CSE 2021 Set 1 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. 12 of them are 2-mark MCQs like this one, and GATE CSE 2021 Set 1 has 2.

How GATE tests Asymptotic Analysis

More from GATE CSE 2021 Set 1

Share this solution

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

GateAI solution cardGATE CSE 2021 Set 1 · Q30 · MCQ

Consider the following recurrence relation. T(n) = T(n/2) + T(2n/5) + 7n & if n > 0 1 & if n = 0 Which one of the following options is correct?

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.