Short: Generate permutations, source code in C
Author: ralf.gruner@t-online.de (Ralf Gruner)
Uploader: ralf gruner t-online de (Ralf Gruner)
Type: misc/math
Architecture: m68k-amigaos
Distribution: Public Domain
This program generates all permutations of the elements of an array.
The example works with an array of characters, but can be changed for
any other element types.
Use the executable in a shell window with this syntax:
permutation
Example:
1.Ram Disk:>permutation abc
abc
acb
bac
bca
cab
cba
The code is a port of a Pascal program I have written in 1988.
The permutations are generated in a recursive function using a mask
for filtering the remainig elements.
The sort algorithm is simple and can be replaced by the library
function qsort or can be removed.
Ralf Gruner, Großschönau, Germany 27 August 1999