You are given a sorted array and a target value. Return the index of the target, or -1 if not found.
This is the canonical O(log n) problem. Before implementing, trace how the search space shrinks with each comparison.
(Analyzing logarithmic search)
You are given a sorted array and a target value. Return the index of the target, or -1 if not found.
This is the canonical O(log n) problem. Before implementing, trace how the search space shrinks with each comparison.