Šimon Tóth’s Post

View profile for Šimon Tóth

C++ Educational Content Creator | 20 years of Software Engineering experience distilled into digestible daily posts

The std::lower_bound and std::upper_bound are arguably the two most practically useful algorithms in the standard library. Both algorithms are binary searches, operating in O(logn) on sorted ranges. The std::lower_bound returns an iterator to the first element not ordered before the provided value and std::upper_bound to the first element ordered after the provided value. Note that the number of comparisons is still O(logn) on non-random-access ranges. However, the number of iterator increments is O(n). Compiler Explorer link: https://lnkd.in/eKXMKFfM #cpp #cplusplus #coding #programming #dailybiteofcpp

  • text

To view or add a comment, sign in

Explore content categories