Permutations: Difference between revisions

Content added Content deleted
Line 3,790:
 
=={{header|Mathematica}}==
Note: The built-in version will have better performance.
Version from scratch:
 
===Version from scratch:===
 
<lang Mathematica>
Line 3,806 ⟶ 3,808:
</lang>
 
{{out}}
Built-in version:
<pre>{{4, 3, 2, 1}, {3, 4, 2, 1}, {3, 2, 4, 1}, {3, 2, 1, 4}, {4, 2, 3,
1}, {2, 4, 3, 1}, {2, 3, 4, 1}, {2, 3, 1, 4}, {4, 2, 1, 3}, {2, 4,
1, 3}, {2, 1, 4, 3}, {2, 1, 3, 4}, {4, 3, 1, 2}, {3, 4, 1, 2}, {3,
1, 4, 2}, {3, 1, 2, 4}, {4, 1, 3, 2}, {1, 4, 3, 2}, {1, 3, 4,
2}, {1, 3, 2, 4}, {4, 1, 2, 3}, {1, 4, 2, 3}, {1, 2, 4, 3}, {1, 2,
3, 4}}</pre>
 
===Built-in version:===
<lang Mathematica>Permutations[{1,2,3,4}]</lang>
{{out}}