I'm working through the fourth edition of Algorithms by Robert Sedgewick and Kevin Wayne and am stumped on exercise 1.1.27 which asks:
Estimate the number of recursive calls that would be used by the code
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) + p*binomial(N-1, k-1, p); }
to compute binomial(100, 50).
Although I'd like like help answering this question, I'd also like to get better at understanding and reasoning about questions of this nature in general and so any help or pointers would be appreciated.
p
, assumed0
? – lurker May 26 '13 at 18:00