Question: using matlab m 4. A function, C(n, k), which computes the number of different ways of uniquely choosing k objects from n without repetition, is

using matlab
m 4. A function, C(n, k), which computes the number of different ways of uniquely choosing k objects from n without repetition, is commonly used in many statistics applications. For exam- ple, how many three-flavored ice cream sundaes are there if there are 10 icecream flavors? To solve this problem we would have to compute C(10, 3), the number of ways of c unique icecream flavors from 10. The function C is commonly called "n choose &." You may assume that n and k are 1 1 integer doubles. If n = k, then clearly C(n, k) = l because there is only way to choose n objects from n objects. If k-1, then C(n, k) n because choosing each of the n objects is a way of choosing one object from n. For all other cases, C(n, k) = C(n-1, k) + C(n-1, k-1). Can you see why? Write a function with header [N]myNChooseK (n, k) that computes the number of times k objects can be uniquely chosen from n objects without repetition. Test Cases: >> N myNChooseK ( 10,1) 10 myNChoosek (10,10) >> N ve 1 >> N = myNChooseK (10,3) N= 120
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
