Find an algorithm (subroutine) that when called repeatedly with the same character-string variable that is initialized with n characters, all different, will cycle through all the permutations of those n characters, so that for example, when called 24 times with a string of length 4, will have cycled that string through all 24 permutations and returned it to its initial state.
(In reply to
re: two ways by friedlinguini)
fl, you're correct--there's no state information stored anywhere except in the string; so multiple areas of a program could call the subroutine on their respective strings without interfering with each other.
I had not seen any notes the first time I looked and saw the problem in the queue, and then the next time I looked it was posted, so I didn't see anyone's comments pre-posting.
|
Posted by Charlie
on 2003-07-03 09:13:19 |