Question
Please write this code in python and make it as simple as possible. Write a program that a. Generates 5000 random numbers and puts them
Please write this code in python and make it as simple as possible.
Write a program that
a. Generates 5000 random numbers and puts them in an array.
b. Sorts the numbers using any sorting technique (Selection sort is fine, but you can tryanother one).
c. Ask the user for a number between 0 and 20,000 and search for it in your sorted arrayusing a simple linear search. Is this a good idea?
d. Ask the user for a number between 0 and 20,000 and search for it in your sorted arrayusing a binary search.
Hint: To generate random numbers you need to include this module:
import random
To get a random number w :
w = random.randint(0,20000)
This will give w a random value between 0 and 20,000
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