@all
it is simple binary search problem
we can write
f(n) = f(n/2 + 2)*f(n/2) + {f(n/2 + 1)}^2 if n is even similary u can get
formula when n is odd.
f(3), f(4), f(5) ----> f(6)
f(6), f(7), f(8) ----> f(12)
.
.
.
as soon as you got a fibnocci number greater than n suppose p-- than you
have two ranges p, p/2;
now apply binary search in range (p/2 & p)
that is cal f(p+p/2) compare the value from n. accordigly move left or
right.
till (p - p/2 != 1)
solution is o(log(n));
hopefully i am clear.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.