Which is better Tim sort or Merge sort?
And why is Tim Sort not so common?
Python uses it.
Tim sort-
Best case - O(n)
Average case - O(n log n)
Worst case - O(n log n)
Merge sort-
Best case - O(n log n)
Average case - O(n log n)
Worst case - O(n log n)
Tim sort is a hybrid stable sorting algorithm, derived from merge sort and insertion sort, designed to perform well on many real life data. Though both have same asymptotic time complexity . Time Complexity just gives us an idea of running time of an algo , it doesn’t mean that two algo having same complexity will be equally good.
Java 7 uses TimSort for objects.