[Tutor] Generate list-of-transforms

Steven D'Aprano steve at pearwood.info
Thu Dec 5 11:54:31 CET 2013


On Wed, Dec 04, 2013 at 10:56:32PM -0500, R. Alan Monroe wrote:
> Given two lists, before and after a sort:
>          0 1 2 3 4
>          ---------
> 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?

Yes there is, it is called a rank table or an index table, depending on 
which direction you wish to go. See my earlier post replying to Alan.


-- 
Steven


More information about the Tutor mailing list