Help in algorithm
Here's the question I'm stuck on.. please help.....
The binomial coefficients can be defined by recurrence equations:
C(n,0) =1 for n>=0
C(n,k) = 1 for n=k
C(n,k)=C(n-1, k-1)+C(n-1, k) for n>k>0
Write a piece of code to compute C(n,k) for n>=k>=0 for each of the following four ways. Determine basic operation for each method and calculate the amount of time for each one. Compare space requirements.
Write recursive method using the above recurrence equations.
Write method by using dynamic algorithm
Write method by using formula C(n,k) = n(n-1)(n-2)...(n-k+1) / k!
Write method by using formula C(n,k) = n! / ( k! (n-k)! )<<<<<<<
You are not going to get a whole bunch of help on assignments that you are suppose to do yourself. If you have a specific question to ask, we could be of more help.
Hi, This is not an assignment or any sort of thing. It's one of the excercise in my book I'm reading for my own knowledge. I just want to know more about computer science. I'm majorred in MIS. So, i was reading this book and came to this excercise, which have no answers in the back. I'd appreciate it if you can really help me out in neways showring me the direction to work this . Thanks
Well, I would suggest that you post some sample code that you may have. If you have not yet written any code, you may want to ask more specific questions. What exactly are you stuck on? I am sure that a number of people could just give you the answer, but you might get more out of it if you tried implementing yourself.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center