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

Best-case runtime = 1. Worst-case = infinity.


I think the joke is that in all cases but the best-case, you won't be around to observe it, this becomes practical once you can create a universe for every permutation and destroy all but the universe which notifies you that it's the best-case.

In all good text books this is left as an exercise for the reader.


In a really good text book, this is left as an exercise that the reader won't do.


No, checking whether a list is sorted is O(n) ;).

Bogosort is O(n) in the best case and O(inf) in the worst case).


Optimize out the check, so it will be O(1) in some cases. ;)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: