Question: TFW 12:46 PM Lab 3 Lab3.docx CSCI 258-Lab #3 Loop Sort Algorithms You will need the LoopSort.java file from Canvas for this lab. Modify this
TFW 12:46 PM Lab 3 Lab3.docx CSCI 258-Lab #3 Loop Sort Algorithms You will need the LoopSort.java file from Canvas for this lab. Modify this class by doing the following: Task 1: Add a static method that copies an array given an array as a parameter and returns a new array containing the same intege use a Java library method to do this. . The method is rs in the same order as the given array Do not Task 2: Write a main method that tests Selection Sort and Bubble Sort. The method must do the following: create an array of 30 random integers create a second array that is a copy of the first array (using the Task 1 method) print the first array (using Arrays.toString0-provide the array as a parameter) call Selection Sort to sort the first array print the sorted array to make sure the numbers are in order call Bubble Sort to sort the second array print the second sorted array to make sure the numbers are in order Run the program a few times to verify that the sorting methods are correct Task 3: Modify the main method so that it computes the amount of time each sorting algorithm takes to sort an array of integers. You will do this by calling System.currentTimeMillisto get the current time in milliseconds (store the result in a long variable, not an int) immediately before you call Selection Sort and again immediately after you call Selection Sort. Use the times to compute how long Selection Sort took and print the result Do the same for Bubble Sort. Dashboard Calendar To Do Notifications Inbox
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
