I’m trying to find the best algorithm for finding a random number between 1-100 using the least number of steps. You can guess a number n using the function guess(n), and you will receive a boolean response true or false. The answer will always be less than the guess you entered into the function if the response is false; if the response is true, it needs to be larger or the guess itself.
I’m trying to find the best algorithm for finding a random number between 1-100
Share
The basic idea:
First guess(50). Depending on the answer, guess(25) or guess(75).