Possible Duplicate:
About python’s built in sort() method
Which of the sorting algorithms does the sort() method use to sort a list of numbers? How can I prove it?
seq = list_of_numbers
seq.sort()
Possible Duplicate:
About python’s built in sort() method
Which of the sorting algorithms does the sort() method use to sort a list of numbers? How can I prove it?
seq = list_of_numbers
seq.sort()
It uses TimSort, an algorithm developed for Python by Tim Peters (of Zen of Python fame).
It is a hybrid of Merge and Insertion sort, and now also in use in Java and Android. The Python source code includes a more detailed description. You'll find the implementation in the listobject.c C source.
The easiest way to determine the sorting algorithm and to prove you're correct is look at the source.
This may enlight you. http://www.daniweb.com/software-development/python/code/216689/sorting-algorithms-in-python
You can prove it by showing the c code under the hood.
This is almost your same question. About Python's built in sort() method
sortmethod use". A python implementation is free to use whatever sorting algorithm that it wants provided that the algorithm is stable.Collections.sort()(so presumably that's also TimSort). Looking for IronPython now..cpythonis not python. It's an implementation and OP is asking about an implementation detail.