[Python-Dev] Re: Why list.sort() uses mergesort and not timsort?

2021年6月06日 16:10:52 -0700

On Sun, Jun 6, 2021 at 2:46 AM Marco Sulla <[email protected]>
wrote:
> As title. Is it faster for inplace sorting, or simply the
> implementation of list.sort() was done before the implementation of
> timsort?
>
As you already know, timsort is pretty close to merge sort.
Timsort added the innovation of making mergesort in-place, plus a little
(though already common) O(*n^2) sorting for small sublists.
I've got a comparison of sort algorithms in both Cython and Pure Python
(your choice) at:
https://stromberg.dnsalias.org/~strombrg/sort-comparison/
...including a version of timsort that is in Cython or Pure Python.
HTH.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/3BF7NHDWVJMPD7NQE4H2LTSLSLHPELZX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to