The Gateway to Computer Science Excellence
+19 votes
1.9k views

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)$
in Algorithms by Boss (16.3k points)
edited by | 1.9k views
+3
Is the question ok?
0
I am getting D, after subsituting values for different numbers.
+2
can someone solve this qus by using recursion TREE!!!?
+3

4 Answers

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

by Boss (14.4k points)
edited by
+1
this is not in aT(n/b) +n power k log n .

How can this be one in ny Master's?
+1
master theorem /...how!!1!
0
How?
+1
There was a typo in question. Corrected now.
0
Thanks!
0
How to do it using back substitution?
0 votes

 

let me know if i am doing any mistake.

by (131 points)
0
Shouldn't it be Math.root(n/2) instead of Math.root(n)/2 ?
0 votes
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)
by (403 points)
0 votes

option c is right

by Boss (35.3k points)
Answer:

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
50,666 questions
56,159 answers
193,768 comments
93,763 users