Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions