First and foremost, this post serves as my first ever competitive programming-related post and also as a testing of the equations and code snippets in this blog. Therefore, tips and advice are highly appreciated. In this post, I would like to write about a commonly used Divide and Conquer algorithm called Binary Search The Answer (BSTA). Many programmers might already know about binary search but some might not be familiar with BSTA. What is BSTA? To recall, binary search is an algorithm for searching a value in a static sorted array by considering the median value and reducing the problem's scope by half, as shown here . Binary search the answer uses a similar principle to a normal binary search of halving the range of the problem. However, we do not binary search a position with a certain value. Instead, we binary search the maximum/minimum value that satisfies the given constraints. In one iteration, we consider the average $mid$ of the current possible range and ...
A blog for mathematics and programming discussions