BINARY SEARCH AI
made by Hadi Afyouni
optimal guessing using binary search
the AI will always find your number in at most 7 guesses

Binary Search AI

optimal guessing • divide and conquer • O(log n)
AI's guess
50
Think of a number between 1 and 100. AI will guess it.
Algorithmic depth
The AI performs a binary search: it maintains a low and high boundary, then guesses the midpoint. Each guess eliminates half of the remaining numbers. This guarantees finding the number in at most log2(100) = 7 guesses. The same principle powers search trees and database indexing.