What is the problem exactly? Do you want to guess the number using a minimum
number of queries (yes/no questions)?
You can use binary search on the interval [1, N] to guess the hidden number
using at most log(N) (rounded up, say) queries (this is what you were
describing, right?).
Given the nature of the queries that you are allowed to make (i.e., does the
number lie in the interval [a, b]?), binary search is optimal.

On 2/25/07, arun soundar <[EMAIL PROTECTED]> wrote:
>
>   hai i want a c program to find the number that you have thinked by
> asking number of questions.the answers of the questions should be yes or
> no.the procedure should be like this.
> if your number lies between 1 500;if it is yes then the next question
> should be
> if your number lies between 1to 250.if the second questions answer is no
> then the next questions should be if your number lies between 251 to 500 and
> so on.thus the limit of the number should be reduced and the number can be
> obtained at the last question.
> think how to solve this problem and send me a reply.
> i wish a quick reply
> diana_cccc <[EMAIL PROTECTED] <diana_cccc%40yahoo.com>> wrote:
>
>
> i really don't know whow to write those sums ...because , they are
> functions of y[t] , but are sums after i , in my first step.
> and i don't know if i made my computer understand that .
>
>
> ---------------------------------
> Here's a new way to find what you're looking for - Yahoo! Answers
>
> [Non-text portions of this message have been removed]
>
>  
>



-- 
"A Mathematician is a machine for turning coffee into theorems." -- Paul
Erdos


[Non-text portions of this message have been removed]

Reply via email to