1. Project Description
2. What Problem Are We Solving?
3. Brief Information About the Data
4. Results
5. Conclusions
Guess the number chosen by the computer with the minimum number of attempts.
The task is to write a program that guesses the number with the minimum number of attempts.
Competition Conditions:
- The computer selects an integer between 0 and 100, and we need to guess it. By "guess," we mean "write a program that guesses the number."
- The algorithm considers whether the random number is greater or less than the target number.
Quality Metric
Results are evaluated by the average number of attempts over 1000 repetitions.
What We Practice
We learn to write good Python code.
The input data is a number in the half-open interval [1, 101).
The binary search algorithm is several orders of magnitude more efficient than random guessing. The complexity of such an algorithm is
Random guessing does not guarantee that the answer will be found in a reasonable number of attempts. However, due to uniform distribution, the correct number will be found on average in about 100 attempts, since the distribution is uniform. The complexity of such an algorithm is Amort.
In the general case, when the probability of each number appearing is equal
Using pseudo-random numbers for "guessing" results in a low probability of finding the correct answer on the first attempt. But on average, it takes
Binary search provides a stable result of
If you find the information in this project interesting or useful, I would greatly appreciate it if you could star the repository and profile ⭐️⭐️⭐️.