[Tutor] Generate list-of-transforms

Alan Gauld alan.gauld at btinternet.com
Thu Dec 5 12:02:07 CET 2013


On 05/12/13 10:52, Steven D'Aprano wrote:
> On Thu, Dec 05, 2013 at 09:55:27AM +0000, Alan Gauld wrote:

>>> before:  3 1 2 5 4
>>> after:   1 2 3 4 5
>>>
>>> Is there a well-known algorithm that can give me the
>>> list-of-transforms that got me from before to after?
>>
>> No.
>> The reason being that it depends on the sorting algorithm
>> used, and there are many.
>
> But they all give the same end result, and hence the same
> transformation. If you want to go from A to B, the transformation
> remains A->B regardless of whether you go directly to B or via C and D.
> The specific sort algorithm doesn't effect the final result.

But the OP didn't ask for the final transform he asked for the list of 
transforms that got from A to B. That means all of the intermediate 
steps. At least that's how I read his statement "list-of-transforms
that got me from before to after"

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list