Question

Consider the following recurrence relation:

T(n)={nT(n)+nfor n≥1,1for n=1.T(n) = \begin{cases} \sqrt{n}T(\sqrt{n}) + n & \text{for } n \ge 1, \\ 1 & \text{for } n = 1. \end{cases}

Which one of the following options is CORRECT?

Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2024 answer key

Solution

Divide both sides of the recurrence by nn and define S(n)=T(n)/nS(n) = T(n)/n to reduce it to S(n)=S(n)+1S(n) = S(\sqrt{n}) + 1.

Dividing both sides of T(n)=nT(n)+nT(n) = \sqrt{n}T(\sqrt{n}) + n by nn gives:

T(n)n=T(n1/2)n1/2+1\frac{T(n)}{n} = \frac{T(n^{1/2})}{n^{1/2}} + 1

Let S(n)=T(n)nS(n) = \frac{T(n)}{n}. Then S(n)=S(n1/2)+1S(n) = S(n^{1/2}) + 1. Substituting n=22kn = 2^{2^k} (so k=log⁡2log⁡2nk = \log_2 \log_2 n and n1/2=22k−1n^{1/2} = 2^{2^{k-1}}):

S(22k)=S(22k−1)+1=⋯=S(2)+k=Θ(log⁡log⁡n)S(2^{2^k}) = S(2^{2^{k-1}}) + 1 = \dots = S(2) + k = \Theta(\log \log n)

Multiplying back by nn gives:

T(n)=n⋅S(n)=Θ(nlog⁡log⁡n)T(n) = n \cdot S(n) = \Theta(n \log \log n)
Final answer

Option (A)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2024 Computer Science and Information Technology - Set 1 (CS1)
Question
42 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.