Page 2 of 2

Posted: Wed Jan 01, 2003 9:16 am
by inteplus
Yes, weird description.

I guess this is what the author hid.
Suppose you use recursive function f(n) to generate permutations of the first n Titans. When you decide which guy to swap with the rightmost.
- n odd: Make the leftmost guy happy.
- n even: Blindly select one-by-one, left-to-right.

Thanks to Adrian and Snap. I got AC.

Posted: Wed Aug 06, 2003 7:42 am
by windows2k
inteplus wrote: Suppose you use recursive function f(n) to generate permutations of the first n Titans. When you decide which guy to swap with the rightmost.
- n odd: Make the leftmost guy happy.
- n even: Blindly select one-by-one, left-to-right.
Sorry , I don't understand what you mean :(
Could you explain more clearly , or take "abcd" for example
thx in advance :)

Posted: Wed Apr 14, 2004 6:45 pm
by gagern
See also Topic 1866.

I also tried this simple recursion:

Code: Select all

perm(0): output current
perm(i): perm(i-1);
         for j=1 to i: swap 0 and i;
                       perm(i-1);
Result: some permutations occur several times, up to 36. Thus others must be missing.

Greetings!

10395

Posted: Wed Mar 12, 2008 10:56 pm
by inva1id
Arighty! Finally got accepted on my own... This thread can be deleted