finding a threshold with minimum tries and limited search point

242 Views Asked by At

I would like to find a threshold with minimum number of tires;
Let's say: I have a apartment with 120 floors and we have piece of glass. I would like to find in which floor the glass is starting to break if we throw. In other word, we want to find threshold floor that the glass starting breaking. In this respect, we can use binary search that returns best result. ($log_2 120=7$ tries) but binary search can break 6 glasses to find it.
Considering we have only two glasses and want to find a threshold floor, what is the optimum solution that minimize number of tries?
Thanks

edited: I should add that, when we have only two glasses, we can only break one and with the other one should find the exact threshold. If we use binary search, in the worst case we have 60 attempts (if the threshold is floor 59, we spare the first on floor 60, then start from floor 1 to 59). Better way is throwing the first glass in each 10 floors. In the worst case, we have 20 attempts (the threshold is floor 119, 11 attempts with the first glass and 9 attempt with the second).

Can you improve the number of attempts?