Question: Overview: You will be given a 2 - d array where each location will contain 0 , 1 , or 2 . Further each row
Overview: You will be given a d array where each location will contain or Further each row and column will be sorted. You will need to find the sum of the entries in the array in different ways and check the amount of time each takes.
Details: Your java program will be provided with a file called input.txt The first line will contain two integers: m the number of rows and n the number of columns. The remainder of the file will contain m cdot n values from which if placed into an m by n array top to bottom, left to right just like reading a normal English text will have each row and column sorted.
You will find the sum of the values in the array in different ways. The first will be the simplest: use nested loops to add the items in time Thetamn The second will be to use a slight variant of bisectionbinary search to find where the row switches from to and from to Using this you can find the sum in time Thetam lg n For your rd method you need to figure out and implement a Thetamn method to find the sum.
Your program should output the sum found by each method even though the values should be equal and the amount of time each took in milliseconds by using System.currentTimeMillis
Picky, but required specifications: Your project must:
be subrnitted via canvas.
consist of or more dotjava files no class files, zip files, input files, or other files should be submitted
have each file begin with a comment containing your name and the project number.
not be placed into any package.
have one file called Projectjava dont be concerned if canvas adds a 'flag' for repeated submissions
compile with the command Javac Projectjava".
run using the command java Project
accept input from a file called input.txt in the same directory as the java files formatted precisely as described above.
accomplishes the goal of the project. In other words, the output should be the correct answer formatted correctly.
be submitted on time early and multiple times is fine
For each listed item you fail to follow, expect to lose at least points. However, submitting via email will guarantee you a zero.
Examples: Your program should work on any valid input. I will be testing on much, much larger inputs. I haven't written my version yet. So the following are not "real" results. Let me know if my handsolution is incorrect dont worry about the exact values for times, but my "guesses" should be within of the right answer
If input.txt contains:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
