# Divide and Conquer Fibonacci

Can someone help me understand how to do the Fibonacci using divide and conquer through recursion?
If my input is Fib(6) what exactly am I trying to divide?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
f(0) =1
f(1) = 1
f(n) = f(n-1) + f(n-2)
0
Author Commented:
I understand the below code but this isn't divide and conquer correct?
I have no clue how to transform this into a divide and conquer algorithm.
Can you give me any other hints?

public static int fib(int n)
{
if ( n ==1 || n==0)
return n;
else
return fib(n-1) + fib(n-2);
}
0
Commented:
>> what exactly am I trying to divide?

Divide and conquer doesn't really work for a Fibonacci series, because you'll end up doing everything twice. Rather go for a simple straight recursion (or better yet, just a loop).
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

ProgrammerCommented:
fibonacci with divide and conquer !!!!!  imposible!
0
Commented:
A more efficient recursion could be
f(2n) = f(n)*(f(n+1)+(f(n-1))
0
Commented:
or
f(2n) = f(n+1)²-f(n-1)²
0
Commented:

f(2n+1) = f(n+1)²+f(n)²
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Algorithms

From novice to tech pro — start learning today.