Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
kccqzy
· 9y ago · 0 comments
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.
Comments
[–]
darethas
9y ago
Last time I looked at the source for Java's dual pivot quicksort implementation, it used exactly this for 7 elements or fewer
[–]
failrate
9y ago
Yes, and qsort does similar (different algorithms for different array sizes but the same function interface).