Descending boundary search
ID: descending-boundary-search
For a nonincreasing array, maintain indices such that entries before exceed the target and entries from onward are at most the target. Probe the middle of the half-open interval. A value above the target advances past that index; otherwise set to that index. The interval length decreases geometrically. At termination the common boundary is the first possible match, so one guarded equality test decides presence even with duplicates.
New to topics? Read the docs here!