Binary search

Binary search algorithms are everywhere, and for good reason. They embody a simple yet powerful idea. In general, algorithms are named with purpose. Let’s take a closer look at this algorithm through an example problem. Problem We are given an ascending sequence of length N and Q requests. Each request consists of a number, and the answer indicates whether that number exists in the sequence. 1 <= N, Q <= 10^5, abs(a[i]) <= 10^9....

May 11, 2023 · 3 min · 525 words · Me