Permutations by swapping: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: add/changed statejents, comments, whitespace, used a template for the output section.)
m (→‎{{header|C}}: Remove vanity tags)
Line 140: Line 140:
Implementation of Heap's Algorithm, array length has to be passed as a parameter for non character arrays, as sizeof() will not give correct results when malloc is used. Prints usage on incorrect invocation.
Implementation of Heap's Algorithm, array length has to be passed as a parameter for non character arrays, as sizeof() will not give correct results when malloc is used. Prints usage on incorrect invocation.
<lang C>
<lang C>
/*Abhishek Ghosh, 25th October 2017*/

#include<stdlib.h>
#include<stdlib.h>
#include<string.h>
#include<string.h>
Line 221: Line 219:
[3,2,1] Sign : -1
[3,2,1] Sign : -1
</pre>
</pre>

=={{header|C++}}==
=={{header|C++}}==
Direct implementation of Johnson-Trotter algorithm from the reference link.
Direct implementation of Johnson-Trotter algorithm from the reference link.