简体   繁体   中英

How to solve the recurrence T(n) = T(n/2) + T(n/4), T(1) = 0, T(2) = 1 is T(n) = Θ(n lg φ ), where φ is the golden ratio?

我尝试了递归树方法,因为master方法不适用于此递归,但似乎也不是正确的方法,将不胜感激!

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 .

PS 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM