Question: Using Python3, Please help with Binary search simulation below. 1. Your program generates a random number between 1 and 1,000 (max number). Then it applies

Using Python3, Please help with Binary search simulation below.

1. Your program generates a random number between 1 and 1,000 (max number). Then it applies the binary search algorithm to automatically guess the random number. For each try, count the number of guesses to find the random number.

2. Repeat the previous step for 10,000 times and sum up the total number of guesses from 10,000 tries. Then compute the average guesses per try based on the 10,000 tries.

3. Repeat the previous two steps with random numbers generated between 1 and 1,000,000 max number instead of 1,000.

4. Output: Display the total and average numbers of guesses from 10,000 tries, one for 1,000 and the other for 1,000,000 max number

Please explain each step and do not use existing code. Thank you!

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!