Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, that's about it. Personally, I'm not sure I'd get this much out of the picture, but you can see the information is there.

> surely it can't be just three iterations?

To save others a search: you stop when the remaining sub-arrays are sorted by definition (ie. [] or [x]/size of 0 or 1).



Also, to save any further puzzling: In practice the very fast sort you use, even if it is labelled "Quicksort" probably doesn't actually do this "all the way down" even though that's the strict algorithm.

They'll have a highly optimised small sort and use that whenever sorting very small things. So e.g. IPN Sort the Rust stdlib unstable sort will do this for 16 items, even though for a big slice it'd quick sort them by default, once it's down to say 10 items they're going to the specialised small sort.

Any serious "fast" sort in 2025 will be a hybrid, using several of these classic sorting algortihms, plus other insights to produce the overall best solution to their problem on modern hardware.




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

Search: