[EMAIL PROTECTED] writes:
[...]
> Thats interesting code but seems to give a different output,
> suggesting thet the underlying algorithm is different.

Yes.

Yours takes the first element out of the list and inserts it in every
position of all the permutations of the list without the first element:

> Ignoring linebreaks and case, the original code gives:
> abcd bacd bcad bcda acbd cabd cbad cbda acdb cadb cdab cdba abdc badc
> bdac bdca adbc dabc dbac dbca adcb dacb dcab dcba

Michele's takes every element out of the list in turn and appends every
permutation of the list without this element to its right:

> The output from the above program, when converted to strings is:
> abcd abdc acbd acdb adbc adcb bacd badc bcad bcda bdac bdca cabd cadb
> cbad cbda cdab cdba dabc dacb dbac dbca dcab dcba
>
> Cheers, Hal.

-- 
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to