|
-
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)! )<<<<<<<
Thanks:
email: desi2go@yahoo.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks