Question: A Fast Algorithm for Searching Consider the following guessing game: one player picks an integer value, call it secret_number, such that 0 secret_number There are

A Fast Algorithm for Searching
Consider the following guessing game: one player picks an integer value, call it secret_number, such that 0 secret_number
There are many different strategies that could be chosen, some better than others; with many strategies you will be lucky sometimes and find the secret_number in very few guesses, but you will find that more often than not you will need quite a few guesses. There is, however, one particular strategy that is guaranteed to always lead to the correct answer in no more than 10 guesses. Can you guess how it works?
Basically the idea is to start with a low bound, lowEnough, and a high bound, tooHigh, on the possible secret_number. In this case, clearly lowEnough = 0 and tooHigh = 1001. The first guess is the number in the middle of the [lowEnough, tooHigh) interval, i.e., (lowEnough + tooHigh) / 2 or 500 in the example. There are two possibilities: (1) secret_number
This algorithm is an example of an interval halving or binary search strategy. Its efficiency comes from the property that at each step we eliminate half of the interval of possible solutions. In the following homework questions you will discover how interval halving can be used to efficiently find integer roots.
 A Fast Algorithm for Searching Consider the following guessing game: one
The Questions Carefully consider and answer the following questions. 1. Suppose someone claims that - 4. How would you verify whether 12 - 4 using powers of 4 and powers of 5? Is - ? 2. Suppose that , r, and root denote integer values where n 0 and r > 0. Further, suppose that really a 0. Further, suppose you would like to know on. When finding by a guess and verify method, is there any reason to try a guess, say g, where g n? Explain. 4. Again, suppose that n and r denote integer values where n 0 and r > 0. What are two "simple" values, say lowEnough and too High, such that lowEnough too High. Explain based on your answer to the previous question. 5. Suppose you would like to know 47226. Explain how you could find 17280 using a guess and verify method. Note: Explain your answer by relating this problem to the number guessing game described earlier. Think about what would be an appropriate question to use in place of "Is secret_number = 0 and r > 0 * Bensures root (r) 0. Further, suppose that really a 0. Further, suppose you would like to know on. When finding by a guess and verify method, is there any reason to try a guess, say g, where g n? Explain. 4. Again, suppose that n and r denote integer values where n 0 and r > 0. What are two "simple" values, say lowEnough and too High, such that lowEnough too High. Explain based on your answer to the previous question. 5. Suppose you would like to know 47226. Explain how you could find 17280 using a guess and verify method. Note: Explain your answer by relating this problem to the number guessing game described earlier. Think about what would be an appropriate question to use in place of "Is secret_number = 0 and r > 0 * Bensures root (r)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!