[Solved] Is there a way to solve this recurring function using dynamic programming?
[ad_1] I think you could use a Dictionary<double,double> to store the results: private static Dictionary<double, double> results = new Dictionary<double, double>(); private static double f(double n) { if (results.ContainsKey(n)) return results[n]; double result = (n > 1) ? f(n – 3) + (9 * (f(n / 5) * f(n / 5))) + (2 * f(n … Read more