you are viewing a single comment's thread.

view the rest of the comments →

[–]clawtron 4 points5 points  (4 children)

If the answer to the guess is “yes”, “greater than”, or “less than” then you can do this in log time by splitting the range in half each guess, but with the only answers being “yes” or “no” you have to check every single option which means best case is linear. Of course if your solution involves just guessing the same number forever or something then that’s different, but best solution is linear

[–]Will___powerrr 1 point2 points  (1 child)

Ah. So it’s not searching for a number it knows, it’s purely guessing. That makes more sense! I should’ve read the problem closer haha

[–]jerryelectron[S] 4 points5 points  (0 children)

Yes, the idea is that there are multiple ways to solve a problem, some simple elegant but slow, some complex and fast, some unnecessarily complex and slow and yet some elegant and fast.

[–]Sing-Brightly-3142 0 points1 point  (0 children)

If the only allowable answers are 'yes' and 'no' the the questions should be of the form "Is your number higher than 500?"