How to estimate the number of recursive calls that would be used by the code
to compute binomial(100, 50)???
public static double binomial(int N, int k, double p)
if ((N == 0) || (k < 0)) return 1.0;
return (1.0 - p)*binomial(N-1, k) + p*binomial(N-1, k-1);
I am looking for the formula that gives me the exact number of calls
I sent an email to writer of the book that I found this problem in it and he answered me:
but still nothing and I am confused
Hint: calculate the number of calls for some small values of N and k and consider functions that involve N! (N factorial) and k! (k factorial).