Permutations by swapping: Difference between revisions
Content added Content deleted
(minor edit) |
(Better format) |
||
Line 2,335: | Line 2,335: | ||
function output([Object[]]$A, [Int]$k, [ref]$sign) |
function output([Object[]]$A, [Int]$k, [ref]$sign) |
||
{ |
{ |
||
"Perm: [$([String]::Join(', ', $A))] Sign: $($sign.Value) |
"Perm: [$([String]::Join(', ', $A))] Sign: $($sign.Value)" |
||
} |
} |
||
Line 2,372: | Line 2,372: | ||
</lang> |
</lang> |
||
<b>Output:</b> |
<b>Output:</b> |
||
⚫ | |||
<pre> |
|||
Perm: [0, 1 |
Perm: [2, 0, 1] Sign: 1 |
||
⚫ | |||
⚫ | |||
⚫ | |||
Perm: [ |
Perm: [0, 1, 2, 3] Sign: 1 |
||
⚫ | |||
Perm: [2, 0, 1] Sign: 1 |
Perm: [2, 0, 1, 3] Sign: 1 |
||
⚫ | |||
Perm: [ |
Perm: [1, 2, 0, 3] Sign: 1 |
||
⚫ | |||
Perm: [ |
Perm: [3, 1, 0, 2] Sign: 1 |
||
⚫ | |||
Perm: [ |
Perm: [0, 3, 1, 2] Sign: 1 |
||
⚫ | |||
⚫ | |||
Perm: [0, 1, |
Perm: [0, 1, 3, 2] Sign: -1 |
||
⚫ | |||
Perm: [1, |
Perm: [1, 2, 3, 0] Sign: -1 |
||
⚫ | |||
Perm: [2, |
Perm: [2, 3, 1, 0] Sign: -1 |
||
⚫ | |||
Perm: [ |
Perm: [3, 1, 2, 0] Sign: -1 |
||
⚫ | |||
Perm: [1, |
Perm: [1, 3, 0, 2] Sign: -1 |
||
⚫ | |||
Perm: [ |
Perm: [3, 0, 1, 2] Sign: -1 |
||
⚫ | |||
Perm: [ |
Perm: [0, 1, 3, 2] Sign: -1</pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
Perm: [0, 1, 3, 2] Sign: -1 |
|||
</pre> |
|||
=={{header|Python}}== |
=={{header|Python}}== |