Permutations/Rank of a permutation: Difference between revisions
Content added Content deleted
Line 1,546: | Line 1,546: | ||
next |
next |
||
func nextPermutation |
func nextPermutation(a) |
||
elementcount = len(a) |
elementcount = len(a) |
||
if elementcount < 1 then return ok |
if elementcount < 1 then return ok |
||
Line 1,565: | Line 1,565: | ||
permutationReverse(a, pos+1, elementcount) |
permutationReverse(a, pos+1, elementcount) |
||
func permutationReverse |
func permutationReverse(a, first, last) |
||
while first < last |
while first < last |
||
temp = a[first] |
temp = a[first] |