dynamic programming: speeding up this function
- by aristotaly
i have this program
//h is our N
static int g=0;
int fun(int h){
if(h<=0){
g++;
return g;
}
return g+fun(h-1)+fun(h-4);
}
is it possible to speed it up using dynamic programming
i fugured out this function runs in O(2^n)
it means that i suppose to reduce this time
but the trouble is that i don get the idea of dinamic programming
even a leading hint or a useful link to a resource will do
it is a work assingment
i do not ask for the solution :)
just asking for the right direction