Find both the lower-bound search boundary and the upper-bound search boundary of a key in a sorted array. Every entry in is at least and at most , so all are equal to . Values immediately outside this interval, when present, are strictly smaller or strictly larger; the interval is consequently maximal. An absent key gives at its insertion position. Two binary searches give total time complexity under constant-cost comparison and indexed access.
New to topics? Read the docs here!