SOLUTION: Write a program that a. Generates 50,000 random numbers and puts them in an array. b. Sorts the numbers using any sorting technique (Selection sort is fine, but you can try

Algebra ->  Test -> SOLUTION: Write a program that a. Generates 50,000 random numbers and puts them in an array. b. Sorts the numbers using any sorting technique (Selection sort is fine, but you can try       Log On


   



Question 1165767: Write a program that
a. Generates 50,000 random numbers and puts them in an array.
b. Sorts the numbers using any sorting technique (Selection sort is fine, but you can try another one). This should take a few minutes to run.
c. Ask the user for a number between 0 and 20,000,000 and search for it in your sorted array using a simple linear search. Is this a good idea?
d. Ask the user for a number between 0 and 20,000,000 and search for it in your sorted array using 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,20000000)
This will give w a random value between 0 and 20,000,000

Answer by ikleyn(52778) About Me  (Show Source):
You can put this solution on YOUR website!
.

At this forum, we do not accept requests on creating/writing computer codes/programs.