Binary Search: an Introduction and a Few Simple Problems
Introducing… Binary Search! This is a relatively simple algorithm that is often referred to as the “easiest of the complex algorithms”. I have to agree. This is a divide-and-conquer algorithm with an O(log N) runtime that is easy to understand and implement, and most problems using binary search are just modifications of the core algorithm. Divide-and-conquer algorithms are exactly how they sound; divide an array and conquer it. Take your array, break it into subarrays, and recursively repeat until you find your target....