edited by
14,555 views
40 40 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)$

6 Answers

Best answer
53 53 votes

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).$$

edited by
1 1 vote
Answer is C it can also be solved by master theorem. by case 1(a>=b^k)

T(n)= aT(n/b)+n^k

Here a = 2 b=2 and k =1/2

so a>= b^k

T(n)=Θ (n^logba)

hence T(n)=Θ(n)
Answer:
Position:
Show:

Related questions

27 27 votes
3 answers 3 answers
9.6k
9.6k views
Ishrat Jahan asked Nov 3, 2014
9,572 views
A hash table contains $10$ buckets and uses linear probing to resolve collisions. The key values are integers and the hash function used is $\text{key}\%10$. If the value...
33 33 votes
2 answers 2 answers
8.4k
8.4k views
Ishrat Jahan asked Nov 3, 2014
8,427 views
In the following table, the left column contains the names of standard graph algorithms and the right column contains the time complexities of the algorithms. Match each ...
43 43 votes
3 3 answers
10.2k
10.2k views
Ishrat Jahan asked Nov 3, 2014
10,181 views
Consider the context-free grammar$E \rightarrow E + E$$E \rightarrow (E * E)$$E \rightarrow id$where $E$ is the starting symbol, the set of terminals is $\{id, (,+,),*\...
36 36 votes
4 answers 4 answers
26.5k
26.5k views
Ishrat Jahan asked Nov 3, 2014
26,497 views
A language $L$ satisfies the Pumping Lemma for regular languages, and also the Pumping Lemma for context-free languages. Which of the following statements about $L$ is TR...