I need a program that can create a 1 dimensional Array with 31 integers by using
ID: 3639226 • Letter: I
Question
I need a program that can create a 1 dimensional Array with 31 integers by using a random number generator, and then output itThen With the program I need to use sequential search and locate the values, any way necessary. It could use a subset of numbers, 1-9 only. Then it needs to report the amount of numbers in the array and count the number of iterations it takes to locate each target value and the elapsed time of the search process. Then output it
An example given:
long startTime = System.nanoTime();
//the operation to be measured
long endTime = System.nanoTime() – startTIme;
Then use selection sort to order the random integers in ascending order, Log the elapsed time to sort the process
Explanation / Answer
Here's the core of the program. You should be able to do the rest. ********************************* import java.util.Random; public class Test { public static void main(String args[]) { int arr[] = new int[31]; Random gen = new Random(); for(int i=0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.