[Solved] Is there a way to solve this recurring function using dynamic programming?


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 - 7)) + ((n * n * n * n) / 2)
        : 4;

    results.Add(n, result);
    return result;
}

solved Is there a way to solve this recurring function using dynamic programming?