True lists in python?

Ian Kelly ian.g.kelly at gmail.com
Sun Dec 19 16:42:27 EST 2010


On Sun, Dec 19, 2010 at 5:59 AM, Vito 'ZeD' De Tullio
<zak.mc.kraken at libero.it> wrote:
> Steven D'Aprano wrote:
>
>> I can't see any way to go from this linked list:
>>
>> node1 -> node2 -> node3 -> node4 -> node5 -> node6 -> node7
>>
>> to this:
>>
>> node1 -> node6 -> node5 -> node4 -> node3 -> node2 -> node7
>>
>> in constant time. You have to touch each of the nodes being reversed.
>
> very crude example: [SNIPPED]


That reverses the whole list.  How does it help with reversing only
part of the list, as in Steven's example?



More information about the Python-list mailing list