I tried recursion tree method since the master method is not applicable for this recurrence but it seems that it is not the right method also, any help would be appreciated !
-
no, I am new to algorithm design and analysis I just want to expand my knowledge. Since I cannot afford to go to college and ask a professor for help maybe here someone can help? have a nice day :) – Bee Dec 08 '15 at 08:09
-
n = n/2 n/4 = 2n/4 + n/4 = 3n/4 n/4 n/4 n/16 = n/16 n/4 + n/4 + n/16 + n/16 = 10n/16 I tried the recursion tree but i believe geometric series wont be applicable since it is not n^2(correct me if im wrong). and I think that this problem has a particular algorithm to apply that is why i asked for help. – Bee Dec 08 '15 at 08:28
1 Answers
Either I have an error somewhere in my derivation or there is an error in your statement.
You do this by unrolling the recursion:
T(n) = T(n/2) + T(n/4) = 2T(n/4) + T(n/8)
T(n) = 3T(n/8) + 2T(n/16)
T(n) = 5T(n/16) + 3T(n/32)
....
T(n) = F(i + 1)T(n/2^(i-1)) + F(i)T(n/2^i)
where F(i)
if a Fibonacci number.
Using boundary condition T(n/2^i) = T(1)
have n = 2^i
-> i = log2(n)
.
T(n) = F(log2(n) + 1) T(2) + F(log2(n)) T(1)
which is equal F(log2(n) + 1)
Now using this formula:
and stripping it to only phi^n
(square root of 5 has nothing to do with complexity and the second thi^n -> 0
if n->inf
) you will get:
T(n) = phi^(log2(n)+1) = phi * phi^log2(n)
which is equal to O(n^log2(phi))
, where log2(phi) = 0.694
.
P.S. Look at it as a hint or a suggestion. Now you do not need college or a professor to learn something. Determination and perseverance is more important. Do not be afraid to try doing something. You already asked this question and claimed to try master method where you failed. People suggested you a completely different approach and here you claim that you tried completely the sam and have not tried the method that worked in a previous case.

- 1
- 1

- 214,103
- 147
- 703
- 753
-
Thanks for answering and for the advice. that is true, I just want someone to explain and show the steps/procedures thoroughly and simple to understand it better. Do not worry i am studying the solutions people gave me because that is why i am here in the first place for the procedures. Have a great day ahead :) – Bee Dec 08 '15 at 09:45