You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks a lot for the primer! When reading question 23, I thought the "recursion" part was meant on the binomial function itself instead of the factorial, so I came up with:
defn_given_k(n, k):
if (k==0) or (k==n):
return1returnn_given_k(n-1, k-1) +n_given_k(n-1, k)
Thanks a lot for the primer! When reading question 23, I thought the "recursion" part was meant on the binomial function itself instead of the factorial, so I came up with:
For reference: https://en.wikipedia.org/wiki/Binomial_coefficient#Recursive_formula
It answers the question, although it is of course very inefficient. A better recursive formula is given in http://penguin.ewu.edu/~trolfe/BinomialCoeff/ .
The text was updated successfully, but these errors were encountered: