Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Sorry but this is a long question(with what i believe to be ashort answer), howe

ID: 3617786 • Letter: S

Question

Sorry but this is a long question(with what i believe to be ashort answer), however i dont understand it so i cant realy shortenit for you. Suppose that we have n distinct objects. There are manydifferent orders that we can select to line up the objects in arow. In fact, there are n! orderings, or permutations, thatcan be obtained with n objects. If we have n objects andselect k of the objects, then there are n!/(n-k)! possibleorderings of k objects. That is the number of differentpermutations of n different ojbects taken k at a time isn!/(n-k)!. Write a function named permute that receivesvalues for n and k, and then returns the number of permutations ofthe n objects taken k at a time. (If we consider the set ofdigits 1,2,3 the different permutations of two digits are 1,2 2,11,3 3,1 2,3 and 3,2) Assume that the corresponding prottypeis int permute(int n; intk); We just learned arrays but they are in the chapter after thisquestion so i dont believe u have to use them. I think thequestion is asking for the maximum number of combinations of nobjects if u take k at a time, but i have no idea what function toright or what the ! means in "n!" or "(n-k)!". Sorry but this is a long question(with what i believe to be ashort answer), however i dont understand it so i cant realy shortenit for you. Suppose that we have n distinct objects. There are manydifferent orders that we can select to line up the objects in arow. In fact, there are n! orderings, or permutations, thatcan be obtained with n objects. If we have n objects andselect k of the objects, then there are n!/(n-k)! possibleorderings of k objects. That is the number of differentpermutations of n different ojbects taken k at a time isn!/(n-k)!. Write a function named permute that receivesvalues for n and k, and then returns the number of permutations ofthe n objects taken k at a time. (If we consider the set ofdigits 1,2,3 the different permutations of two digits are 1,2 2,11,3 3,1 2,3 and 3,2) Assume that the corresponding prottypeis int permute(int n; intk); We just learned arrays but they are in the chapter after thisquestion so i dont believe u have to use them. I think thequestion is asking for the maximum number of combinations of nobjects if u take k at a time, but i have no idea what function toright or what the ! means in "n!" or "(n-k)!".

Explanation / Answer

5! is 5*4*3*2*1 = 120 7! is 7*6*5*4*3*2*1= 5040
Here is progamme
#include<iostream> using namespace std;
int permute(int,int); int main() { int n,k; cout<<"Enter the value of n: "; cin>>n; cout<<" Enter the value of k: "; cin>>k; int result=permute(n,k); cout<<" Result: "<<result; system("pause"); return 0; }
int permute(int n, int k) { long nfac,kfac,total=1; for( int v=n;v>=1;v--) { total*=v; } nfac=total; total=1; for(v=n-k;v>=2;v--) total*=v;
kfac=total;
return nfac/kfac; }
#include<iostream> using namespace std;
int permute(int,int); int main() { int n,k; cout<<"Enter the value of n: "; cin>>n; cout<<" Enter the value of k: "; cin>>k; int result=permute(n,k); cout<<" Result: "<<result; system("pause"); return 0; }
int permute(int n, int k) { long nfac,kfac,total=1; for( int v=n;v>=1;v--) { total*=v; } nfac=total; total=1; for(v=n-k;v>=2;v--) total*=v;
kfac=total;
return nfac/kfac; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote