Groovy hepcat lovecreatesbeauty was jivin' on 20 Jun 2006 18:56:19
-0700 in comp.lang.c.
Re: permutation generation's a cool scene! Dig it!
Hi, it was not the OP but me has responded to your posts.
I would like to see how those "unique" are programmed in your C code
but not just in a dummy shell script.

Yes, if you have done it in C
It's simple, really. It surprised me how simple it was when I
figured it out. All you do is sort the substring first; then when
rotating, if the same character comes into the initial position of the
substring as was there previously, you just keep rotating.
To demonstrate this, take the (sorted) string "abbc". Now, on first
iteration of the critical loop the permutation is "abbc". Then you
rotate the string, and the second iteration yeilds "bbca". Rotate
again, and we get "bcab". But, since this string begins with the same
letter as the previous one, we skip this one and keep revolving. So we
next get "cabb".
I hope that makes sense.
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?