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.Com
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) (Show Source): You can put this solution on YOUR website!
.
At this forum, we do not accept requests on creating/writing computer codes/programs.
RELATED QUESTIONS
Please help: write the following numbers using appropriate SI symbol and write the... (answered by verclau)
paige wrote a computer program that generates two random numbers between 1 and 11. when... (answered by MathLover1,greenestamps)
Subject: locating a number in a triangular array of numbers
[Question]
if the... (answered by scott8148)
not sure of how to work this problem. A revenue of $1500 is obtained form the sales of... (answered by Earlsdon)
Excel RAND Function. Most computer languages include a function that can be used to... (answered by onyulee)
Infinte Jackpot is a lottery game. 50 balls numbered 1 through 50 are placed in a machine (answered by ikleyn)
A random number generator generates numbers between 0 and 10. Let random variable X be... (answered by rothauserc)
The natural numbers 1 ≤ n ≤ 25 are arranged in a square array of five rows... (answered by richard1234)
""Untitled," by Stephen Chen
I've often wondered how software is released and sold to... (answered by CPhill)