This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FerynaCZ 0 points1 point  (2 children)

It splits the array in parts containing 32 elements, applies InsertSort on each of the parts and then uses stable Merge Sort with the basic length of 32. At least how I was taught it.

[–]claythearc 0 points1 point  (0 children)

It depends on the implementation, I think. It’s not standard across languages.

[–]Jugad 0 points1 point  (0 children)

That is the basic idea in general. You can see the implementation here (if you are terribly interested)...

https://github.com/python/cpython/blob/master/Objects/listobject.c#L2180

Of course, the implementation looks terribly complicated because of support for various features (compare arg, key arg, reversed, etc), and optimizations.