Time-complexity of recursive algorithm for calculating binomial coefficient
问题 I'm studying about algorithm complexity analysis. I have problem with unconformity or C(n, k) . int C(int n, int k){ if(n==k || k==0) return 1; return C(n-1, k) + C(n-1, k-1); } How can I determine its execution complexity or T(n) ? 回答1: The recurrence you are looking for is T(n,k) = T(n-1,k) + T(n-1,k-1) + O(1) with T(n,n) = T(n,0) = O(1) Obviously n is decreased by one every step. If we ignore (just for the moment) that there is a parameter k, basically the number of calls doubles every