is there proceed speed adult recursion remembering child nodes?
for example,
look during formula calculates n-th fibonacci number:
fib(int n)
{
if(n==0 || n==1)
relapse 1;
relapse fib(n-1) + fib(n-2);
}
the problem formula beget smoke-stack yield blunder any array incomparable 15 (in many computers).
assume calculating fib(10). process, contend fib(5) distributed lot times. there proceed store memory quick retrieval thereby boost speed recursion?
i am looking general technique used roughly problems.
Comments
Post a Comment