Timsort (source code)

= Timsort
{wiki=Timsort}

Timsort is a hybrid sorting algorithm derived from merge sort and insertion sort. It is designed to perform well on many kinds of real-world data. The algorithm was developed by Tim Peters in 2002 for use in the Python programming language, and it is the default sorting algorithm in Python's built-in \`sorted()\` function and the \`list.sort()\` method. Timsort is also used in Java's Arrays.sort() for objects.