Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Restrictions: you cannot use any methods from the Java Array ( s ) class to copy an array, check for equality, or otherwise manipulate an
Restrictions: you cannot use any methods from the Java Arrays class to copy an array, check for equality, or otherwise manipulate an array. You must write the Java code to perform these functions.
Allowed imports:
java.util.Random
Create a NetBeans project named Lab and ensure it is saved to a location like desktop or your flash drive. In the project you will do the following:
In this assignment you are to:
Implement the five methods in Code Fragment on page of the textbook.
Measure the run times for each algorithm as the number of items they process increases, ie as N increases, storing your results in a twodimensional array.
Use the System.nanoTime method to measure the run times.
Display your results in a correctly formatted ASCII table.
Create a Client Class that will time each of the algorithms for increasing values of N
N should start at and double on each pass
For each pass create arrays of random integers to use as test data.
You may want to set the maximum value of N at less than This took minutes to run on my system.
Once you have collected all of the results display the results in a correctly formatted ASCII table. See example below.
You must use the System.out.printf method to print your table.
Note that the width of each column in the table is determined by the width of the widest value in that column
Each data row is separated by a separator row made up of and characters
On each data row the values are separated by a
Each data value has two blank spaces before and after the value cell padding
The characters in the separator rows line up with the symbols in the data rows
The table begins and ends with a separator row
The numerical values line up vertically
o Numerical values are displayed with the thousand comma separator
o For your table to display correctly in your word document you must set your font to Courier New or some other fixwidth font
o You may also need to set the row space to for both before and after
The data displayed in this example are for illustrative purposes only.
Your results might or might not match the values give in the example.
Things to turn in:
Open a Microsoft Word document name using the following file naming convention
o ie LabLnameFM
Lab assignment prefix
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started