News for hackers. Stuff that matters.
Re:Binary Search Reconsidered (2018) by karlding on Friday December 25, 2020 @05:11PM (#25539426)
The Competitive Programmer's Handbook by Antti Laaksonen (pllk) [0] presents an alternative formulation which seems fairly intuitive to derive. The idea is to take a "normal" for-loop iterating through the entire array (a constant step size of 1), and instead use a large initial step size (n/2) which halves at each iteration.

[0] https://cses.fi/book/index.php

There are no comments on this comment yet.