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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started