Home / Expert Answers / Computer Science / nbsp-think-a-number-bob-and-alice-play-a-game-in-which-bob-gives-alice-a-challenge-to-think-of-pa947

(Solved):   Think a Number Bob and Alice play a game in which Bob gives Alice a challenge to think of ...



Think a Number
Bob and Alice play a game in which Bob gives Alice a challenge to think of any number \( \mathrm{M} \) between

 

Think a Number Bob and Alice play a game in which Bob gives Alice a challenge to think of any number \( \mathrm{M} \) between 1 to \( \mathrm{N} \). Bob then tells Alice a number \( \mathrm{X} \). Alice has to confirm whether \( \mathrm{X} \) is greater or smaller than number \( M \) or equal to number M. This continues till Bob finds the number correctly. Your task is to find the maximum number of attempts Bob needs to guess the number thought of by Alice. Input Specification: input1: \( N \), the upper limit of the number guessed by Alice. \( (1<=N<=108) \) Output Specification: Your function should return the maximum number of attempts required to find the number \( M(1<=M<=N) \). Example 1:


We have an Answer from Expert

View Expert Answer

Expert Answer


It is given that the range of N is from 1 to 108. And Alice thinks any one of the numbers from 1 to 108. And we need to find in how many attemps bob c
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe