Permutations by swapping: Difference between revisions

Content added Content deleted
(Better format)
(Full test)
Line 2,366: Line 2,366:
generate $array $array.Count ([ref]1)
generate $array $array.Count ([ref]1)
}
}
permutation @(0, 1, 2,3 )
permutation @(0, 1, 2)
""
permutation @(0, 1, 2, 3)
</lang>
</lang>
<b>Output:</b>
<b>Output:</b>
<pre>
<pre>
Perm: [0, 1, 2] Sign: 1

Perm: [1, 0, 2] Sign: -1

Perm: [2, 0, 1] Sign: 1

Perm: [0, 2, 1] Sign: -1

Perm: [1, 2, 0] Sign: 1

Perm: [2, 1, 0] Sign: -1


Perm: [0, 1, 2, 3] Sign: 1
Perm: [0, 1, 2, 3] Sign: 1


Line 2,416: Line 2,431:
Perm: [1, 0, 3, 2] Sign: 1
Perm: [1, 0, 3, 2] Sign: 1


Perm: [0, 1, 3, 2] Sign: -1
Perm: [0, 1, 3, 2] Sign: -1

</pre>
</pre>