35 ms·
Author is demonstrating a kind of binary search. Of course, binary search requires a target value, something to search, so your toy problem is underspecified.
by uoaei 4y ago
Author is demonstrating a kind of binary search. Of course, binary search requires a target value, something to search, so your toy problem is underspecified.
Then your next interval would be (1/2, 2/3) or (2/3, 3/4) depending on whether s > 2/3 or s < 2/3, where s is your search term.