Quick sort implementation in python

"Martin v. Löwis" martin at v.loewis.de
Fri Sep 26 23:13:49 CEST 2008


>> Can you please explain how you did that in C? IOW, how did you do
>> the partition function (template) in case you don't have random
>> access to the collection?
>>
> 
> Why exactly do you need random access for partition function?

This is a counter-question, not an answer. Let me ask again: How did
you do that in C++?

> Do can
> swap 2 nodes of a linked list without random access (you can swap the
> pointers or just swap the node values) and you traverse the list till
> you reach it's tail.

In Python, there is no standard iterator that allows you to modify the
underlying collection. There is the iter() function/type, but it only
allows read access.

Regards,
Martin



More information about the Python-list mailing list