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
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: 
bc(n, k) = if k is zero, if k equals n bc(n-1, k-1) + bc(n-1,k) otherwise. 1 public class Interval Interval (double min, double max) range is from min to mar, inclusive boolean contains (double x) is x in the interval of the object? does this interval and b intersect? string representation of interval boolean intersects (Interval b) String toString() Provide a complete class and test the API in the main method.
Step by Step Solution
3.28 Rating (154 Votes )
There are 3 Steps involved in it
Heres how you can implement both tasks in Java 1 Recursive Function for Binomial Coefficients Create ... View full answer
Get step-by-step solutions from verified subject matter experts
