Hacker News new | past | comments | ask | show | jobs | submit login

There are such things as sensible defaults though.

Timsort being a somewhat famous example, which uses the fact that python datastructures are known length to figure out the best sorting method for the size.

If you need something more exotic then you likely know more about what you're doing, but most people writing software who need a sort function usually don't need more than timsort.




> uses the fact that python datastructures are known length to figure out the best sorting method for the size.

That... does not match with my knowledge of how timsort works. The sorting method is chosen based on the array length, and every sorting algorithm in every language knows that. It's extremely suboptimal for some types because Python's typing is so weak!

Timsort succeeds because it has many good heuristics to optimize common properties of its merge intervals.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: