News for hackers. Stuff that matters.
Re:“It is never a compiler error” by kccqzy on Tuesday November 14, 2017 @05:36PM (#15699868)
A common optimization is to use insertion sort for small arrays (less than 64) and quicksort/heapsort/introsort for larger ones. Usually because better algorithms in terms of Big O have worse constant factors.
Re:“It is never a compiler error” by darethas on Tuesday November 14, 2017 @05:48PM (#15699974)
Last time I looked at the source for Java's dual pivot quicksort implementation, it used exactly this for 7 elements or fewer
Re:“It is never a compiler error” by failrate on Tuesday November 14, 2017 @08:35PM (#15700857)
Yes, and qsort does similar (different algorithms for different array sizes but the same function interface).