1. Write a recursive function be that calculates the number of ways of selecting k elements out...
Fantastic news! We've Found the answer you've been seeking!
Question:
1. Write a recursive function be that calculates the number of ways of selecting k elements out of n elements using the following relationship:
That is, bc(n, k) = bc(n-1, k-1) + bc(n-1, k) except that bc (n, 0) returns 1 and bc(k,k) returns 1.
Place the function in a clam called HW5. Test your recursive function in the main method by printing out the returned values of bc(3,3), bc(3,0), bc(3,2), and bc(8,5).
2. Write a clam Interval with the following API:
Related Book For
Elementary Statistics Picturing the World
ISBN: 978-0134683416
7th edition
Authors: Ron Larson, Betsy Farber
Posted Date: