Write Mathematical code that for a list A and a number k wil

Write Mathematical code that for a list A and a number k will display a list of all subsets of A that are of size k, and the number of subsets of A that are of size k. For example, if A = {3, 2, 3, 5} and k = 2, then your code should display {{3,2},{3,5},{2,5}} and 3. You may use any function except Needs.

Solution

The mathematica has an inbuilt function to find the list of all the subsets ot the length K

Subsets [ list, {k} ]

=> this will make the subsets of length k from the list A

subset_count = n!/((n-k)!k!);

subset_count

 Write Mathematical code that for a list A and a number k will display a list of all subsets of A that are of size k, and the number of subsets of A that are of

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site