Need C Algorithm

Warren Lobel wsl at eosp1.UUCP
Thu Dec 13 05:59:58 AEST 1984


My friends and I have come across an interesting coding problem. We are
trying to write a program that given a string of digits (or letters) of
length N will generate all N factorial permutations of those digits.
For example: For the word 'cat' the program will generate the following:
		cat
		cta
		act
		atc
		tca
		tac

The ordering is arbitrary and should be dependent on the algorithm used.
At first this seems to be a rather trivial task, however, it is much more
difficult then it appears to be initially. I would appreciate any help
in writing this algorithm, preferrably in 'C' but any language (though I
suspect a language that can handle recursion is best) will do.

Please mail me the solution or at least which newsgroup it is posted in.

		Thanks a lot
		Warren S. Lobel
		Exxon Office Systems
		Princeton, NJ



More information about the Comp.lang.c mailing list