Talk:Permutations by swapping: Difference between revisions

Content added Content deleted
(What is the task again?)
(→‎Does "Python: recursive" fit this task?: successive items by a swap between two items plus give the sign.)
Line 16: Line 16:
::So the order of the output doesn't matter, as long as it is true that adjacent results differ by a swap of adjacent elements? How would one verify this easily? Perhaps a function to verify that the results satisfy this should be a part of the task, because it is insufficient to simply show that all the permutations are generated. --[[User:Spoon!|Spoon!]] 00:07, 3 August 2012 (UTC)
::So the order of the output doesn't matter, as long as it is true that adjacent results differ by a swap of adjacent elements? How would one verify this easily? Perhaps a function to verify that the results satisfy this should be a part of the task, because it is insufficient to simply show that all the permutations are generated. --[[User:Spoon!|Spoon!]] 00:07, 3 August 2012 (UTC)
:::Well:
:::Well:
:::* If the items doesn't change. (Sort them and compare).
:::* If the items (of each successive perm), doesn't change. (Sort them and compare).
:::* And if exactly two items are not in the same position as before.
:::* And if exactly two items are not in the same position as before.
:::* Then the two consecutive permutations are OK.
:::* Then the two consecutive permutations are OK.
:::--[[User:Paddy3118|Paddy3118]] 07:35, 3 August 2012 (UTC)
:::--[[User:Paddy3118|Paddy3118]] 07:35, 3 August 2012 (UTC)
:::: This is confusing. If the task is to use the Steinhaus–Johnson–Trotter algorithm then the permutations must appear in a specific order. If the task is to find the parity of a permutation, then we do not need the Steinhaus–Johnson–Trotter algorithm. So... what's the task? --[[User:Rdm|Rdm]] 07:58, 3 August 2012 (UTC)
:::: This is confusing. If the task is to use the Steinhaus–Johnson–Trotter algorithm then the permutations must appear in a specific order. If the task is to find the parity of a permutation, then we do not need the Steinhaus–Johnson–Trotter algorithm. So... what's the task? --[[User:Rdm|Rdm]] 07:58, 3 August 2012 (UTC)
:::::That particular ''algorithm'' is given as an example, but you are free to use another that fits the requirements. In the explanations I read of the SJT algorithm, they mentioned swapping quite a lot - hence the task title.


== bear in mind? ==
== bear in mind? ==