The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+13 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?

  1. $T(n) = \Theta(\log n)$
  2. $T(n) = \Theta(\sqrt n)$
  3. $T(n) = \Theta(n)$
  4. $T(n) = \Theta(n \log n)$
asked in Algorithms by Veteran (21.9k points)
edited by | 953 views
Is the question ok?
I am getting D, after subsituting values for different numbers.
can someone solve this qus by using recursion TREE!!!?

1 Answer

+20 votes
Best answer

Option C it can be done by Master 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).$$

answered by Veteran (14.1k points)
edited by
this is not in aT(n/b) +n power k log n .

How can this be one in ny Master's?
master theorem /!!1!
There was a typo in question. Corrected now.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

32,732 questions
39,309 answers
36,733 users