Dark Mode

7,390 views

27 votes

Let $T(n)$ be a function defined by the recurrence

$T(n) = 2T(n/2) + \sqrt n$ for $n \geq 2$ and

$T(1) = 1$

Which of the following statements is **TRUE**?

- $T(n) = \Theta(\log n)$
- $T(n) = \Theta(\sqrt n)$
- $T(n) = \Theta(n)$
- $T(n) = \Theta(n \log n)$

@gatecse @Abhrajyoti00 @Kabir5454

Somebody explain How( see comment of @piyushwm)

$\sqrt{2}^{logn} = \sqrt{n}$

and

In the gp , how you came to know that number of terms = logn not logn +1

0

36 votes

Best answer

Option $C$** **is the answer. It can be done by Master's theorem.

$n^{\log_b a} = n^{\log_2 2} = n$.

$f(n) = \sqrt n = n^{\frac{1}{2}}$.

So, $f(n) = O\left(n^{\log_b a -\epsilon}\right)$ is true for any real $\epsilon$, $0 < \epsilon < \frac{1}{2}$. Hence Master theorem Case 1 satisfied,

$$T(n) = \Theta\left(n^{\log_b a}\right) = \Theta (n).$$