4 ms·
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
by meribold 5y ago
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 https://en.cppreference.com/w/cpp/container/set/begin
[2]: https://en.cppreference.com/w/cpp/container/set/rbegin https://en.cppreference.com/w/cpp/container/set/rbegin