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

In C++ (for example) getting the minimum and maximum is an O(1) operation [1][2]. I guess this is probably enabled through some extra bookkeeping and many other languages may do the same.

[1]: https://en.cppreference.com/w/cpp/container/set/begin

[2]: https://en.cppreference.com/w/cpp/container/set/rbegin




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: