in Algorithms retagged by
449 views
0 votes
0 votes
How to solve the given recurrence relation using master's theorem?

T(n)=T(${n^{1/2}}$)+n
in Algorithms retagged by
449 views

3 Comments

What is the base condition of this question?
0
0
not given but take appropriately..

May be T(1)=1
0
0
I think this question can be solved much easily using substitution method
0
0

2 Answers

2 votes
2 votes
Best answer
$\text{I'm trying to solve the recurrence relation:}$

$$T(n) = T(\sqrt n) + n$$

$\text{My first step was to let $n=2^{m}$}$

 $$T(2^m) = T(2^{m\cdot 1/2}) +2^{m}$$

$\text{if S(m) = $T(2^m)$ then,}$

$$S(m) = S(m/2) + 2^m$$

 $\text{This is an easier recurrence to solve.}$

$\text{If I try and use the Master Theorem, I calculate $n^{\log_b a}$}$

$\text{where a=1 and b=2 to be $n^{\log_2 1}$ which gives $n^0=1$.}$

$\text{It seems like this might be case 2 of the Master Theorem where }$

$\text{ $n^{\log_b a}$<f(n),where f(n)=$2^m$}$

$\text{According to master's condition T(n)=$\theta(f(n)(logn)^k)$where $k>=0$)}$

$\text{T(n)=$\theta(2^m)$}$

$\text{so,Ans is $T(n)=\theta(n)$}$
selected by

4 Comments

$\Theta(n)$  is correct.

How are u getting $\theta (n \log\log n)$ ??
0
0
The solution to the recurrence $S(m) = S(m/2) + 2^m$

is $2^m \cdot \log m$

Substituting $\log n = m$

We get $2^{\log n} \cdot \log \log n$

Which is $O(n \cdot \log \log n)$

Correct me if I'm wrong.
0
0

@toxicdesire  here case 3 of masters theorem is applied..

 

$T(n)=T(n/2)+2^n\implies \Theta(2^n)$

can you share your approach?

0
0
1 vote
1 vote

T(n)= o(n)