
09/05/15 07:25:03 Hi :)
09/05/15 15:09:59 *** Join: Mizcu (i=irc@dslsjkbrasgw1ff53c100155.dhcp.inet.fi)
09/05/15 22:25:34 *** Join: Lithium (n=IceChat7@philcatt.gotadsl.co.uk)
09/05/15 22:28:12 any of you guys know an algorithm to generate the Nth unique permutation when n < r?
09/05/15 22:28:43 i have one idea at least but i think it must not be optimal
09/05/15 22:29:30 (for example, 6 character permutations with the set {a, b, c})
09/05/15 22:34:16 No idea, sorry.
09/05/15 22:34:38 no worries, just thought this'd be a good place to inquire for references
09/05/15 22:50:02 I assume using each character from the set once and no duplicate characters in the set.
09/05/15 22:55:09 well, you'd have to use em twice
09/05/15 22:55:16 aabbcc, aabcbc, etc.
09/05/15 22:55:30 but if you just take "aabbcc" and use a permutation algorithm, you'll get 8 duplicates of every possibility
09/05/15 22:55:50 the best i've got so far is to take one letter at a time and permute it via the following pattern:
09/05/15 22:56:12 aa????, a?a???, a??a??, .... ?aa???, ?a?a??, ?a??a?, ...
09/05/15 22:56:21 then permute the remaining letters in the ? spaces the same way
09/05/15 22:56:37 it seems i ought to be able to calculate the positions in that simple case with some math, but i haven't worked it out yet
09/05/15 22:56:48 can't sit down for that much consecutive time while i'm workin :P
09/05/15 22:59:51 i guess i stated that wrong at first.. what i actually want to do is permute an N character string, the repetitions may vary
09/05/15 23:00:02 that is, aaabbc would have a different result than aabbcc, but i want to calculate either
09/05/15 23:00:12 so the initial set can't be just a, b, c
09/05/15 23:00:19 it's gotta explicitly state all 6 (or whatever the total is)
09/05/15 23:17:08 I can't really think of anything.
09/05/15 23:18:07 I'd tag them somehow so I had A1, A2, B1, B2, C1, C2 and alter the permutation algorithm to ensure A1 doesn't get used before A2, etc.
09/05/15 23:18:49 But that's probably the dumb way to do it. :)
09/05/15 23:19:13 wouldn't work with at least one algorithm i saw, but the ordering concept is interesting
09/05/15 23:19:34 i hadn't considered that