Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i have a question about python programming. please give me the correct answer. Binary search Assuming that you and your friend are playing the game

i have a question about python programming. please give me the correct answer.

image text in transcribed

Binary search Assuming that you and your friend are playing the game "Guess the number". Your friend will choose an integer in the closed interval [27,1238], i.e. from 27 to 1238 inclusively. Your goal is to guess what the chosen integer is. Every time when you make a guess, your friend will tell you whether your guess is equal to, greater than or less than the chosen integer. If your guess is equal to the chosen number, then the game ends. Having taken the course ENGG1811, you know the best algorithm to use is binary search. For this question, we will assume that you use the binary search algorithm outlined in Part C of the lab and in particular we choose to round down to get the middle element. Assuming that, for a chosen integer, it took you more than 3 guesses to end the game, which one of following sequence of numbers could be your first 3 guesses? Note that there is only one correct answer. 632, 935, 1086 O 632, 935, 1087 O 632, 934, 1086 632. 934. 1087

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2. Do you find change a. invigorating? b. stressful? _______

Answered: 1 week ago

Question

10. Are you a. a leader? b. a follower? _______

Answered: 1 week ago