SLORES@umiami.miami.edu (Stanislaw L. Olejniczak) (07/21/89)
A question about a (?) simple algorithm and the "best" implementation: In last few years I have repeatedly encountered a need to have an algorithm to produce all permutations of a given ordered set. To make sure I am making sense; I follow with, I hope, a clear example at the end. I have never felt I have found a "best" solution. If you know of a generally accepted, or at least one you would recommend, algortihm, I would appreciate either its definition or appropriate references. From past experience I will not promise a summary, but I will send raw copy of replies to anyone who emails a request. If you do not want your reply included raw, please mark it so at the beginning, and I will include only a reasonable summary of it; if you would rather not have even that, also please mark your reply so. Thanks As to an example: Lets say that I have three variables, A, B, C, that can take mA to nA, mB to nB, and mC to nC values, respectively, where it is not given that any of those values equals any other, though ranges can overlap: ex>; A: 1,2,3 B: 2,3,4,5 C: 7,8 I need to produce ordered sets: 1,2,7 1,2,8 1,3,7 1,3,8 1,4,7 1,4,8 1,5,7 1,5,8 2,2,7 2,2,8 etc. 3,5,7 3,5,8 2,7,1 2,8,1 3,7,1 3,8,1 etc. for all possible permutations of A, B and C values. Duplicates are O.K., but if the algorithm would (optionaly) elimate them, that WOULD be nice. Any suggestions would be most welcomed. -- Stan Olejniczak Internet: slores@umiami.miami.edu University of Miami, FL USA UUCP: (temp void) gould!umbio!solejni SLORES@UMIAMI.BITNET UUCP: (?) umigw!gables!slores Voice: (305) 547-6571 FAX: (305) 548-4612 My opinions cannot possibly represent the views of anyone else!