Re:Binary search with confidence
by cleancoder0 on Monday March 07, 2022 @07:03AM
(#30586759)
I believe half-open intervals is something C++ uses for std::lower_bound and std::upper_bound.
[ Parent
| on HN ]
Using half-open intervals for std::lower_bound and std::upper_bound has an unexpected benefit. It allows the functions to return an insertion point that keeps the sequence sorted, even if that insertion point is at the end of the sequence.
Re:Binary search with confidence
by thaumasiotes on Monday March 07, 2022 @07:24AM
(#30586927)
Half-open intervals are very common because they overlap perfectly.