Binary Search
Use left and right pointers, compute the middle index, and discard half the range each step based on the comparison.
Given a sorted list and a target, return the target index or -1 if it is missing.
Tagged with binary-search
Use left and right pointers, compute the middle index, and discard half the range each step based on the comparison.
Given a sorted list and a target, return the target index or -1 if it is missing.