Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread R. Alan Monroe
> What does the OP actually want? I started writing another fake defrag program to entertain myself in a little downtime at work. The FAT-styled "drive" is just a Python list of integers where each element points to the the next "block" of the fictitious "file", with the last element of any given

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread R. Alan Monroe
> There is a name for this: it is called a RANK TABLE. Handy. That should help. Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread spir
On 12/05/2013 12:02 PM, Alan Gauld wrote: 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" I did not re

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread spir
On 12/05/2013 11:52 AM, Steven D'Aprano wrote: There is a name for this: it is called a RANK TABLE. In the example given: values = [3, 1, 2, 5, 4] the rank table gives the rank of each element, that is, the position they would get after sorting. In this case, the rank table is not terribly exci

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread Alan Gauld
On 05/12/13 10:52, Steven D'Aprano wrote: On Thu, Dec 05, 2013 at 09:55:27AM +, 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 s

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread Steven D'Aprano
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 a

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread Steven D'Aprano
On Thu, Dec 05, 2013 at 09:55:27AM +, Alan Gauld wrote: > On 05/12/13 03:56, 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 >

Re: [Tutor] Generate list-of-transforms

2013-12-05 Thread Alan Gauld
On 05/12/13 03:56, 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? No. The reason being that i

Re: [Tutor] Generate list-of-transforms

2013-12-04 Thread Danny Yoo
I believe you're asking for the term "Cycle notation". http://en.wikipedia.org/wiki/Cycle_notation On Wed, Dec 4, 2013 at 7:56 PM, 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 the

Re: [Tutor] Generate list-of-transforms

2013-12-04 Thread xDog Walker
On Wednesday 2013 December 04 19:56, R. Alan Monroe wrote: > This seems like the kind of thing that probably exists, but there > isn't a simple googlable term for searching it out conveniently. Try "sorting algorithm". -- Yonder nor sorghum stenches shut ladle gulls stopper torque wet strainers

[Tutor] Generate list-of-transforms

2013-12-04 Thread R. Alan Monroe
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? e.g.: first-to-zeroth, zeroth-to-second, second-to-first fourth-to-third