i need to write functions that gives back the permutation of an integer.(adsbygoogle = window.adsbygoogle || []).push({});

i have already the factorial function in, so here what i did so far:

i can assume that MAXCOL is 7, you can assume that n<=7.

so far as you can see im printing the list order i.e if n=2Code (Text):

int perm(int n)

{

MAXROW=fact(MAXCOL);

int perms[MAXROW][MAXCOL], i,j;

for(j=0;j<n;j++){

for(i=0;i<fact(n);i++){

perms[i][j]=j+1;

}

}

then

now i want to be able to unchange the first line and then go to the second line and change it, and then change the third line that it wouldn't be identical to formers, and so forth.Code (Text):

12

12

the problem i don't know how to implement it, obviously some sorting is in place but which?

thanks in advance.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Calculating permutaions.

**Physics Forums | Science Articles, Homework Help, Discussion**