Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Interfaces Implemented import java.util.ArrayList; public interface sortAnalysis

ID: 3846436 • Letter: I

Question

Interfaces Implemented

import java.util.ArrayList;

public interface sortAnalysis<E extends Comparable<? super E>> {

/**

* Sorts the list of elements and returns the amount of time required to sort them. (in milliseconds)
* @param list
* A list of comparable elements to be sorted and analyzed.
* @return list The time required to sort the list.
*/
public long analyzeSort(ArrayList<E> list);
}

public interface MatrixAnalysis {
/**
* @param double[][] m1 The first square matrix to multiply
* @param double[][] m2 The second square matrix to multiply
* @param double[][] m3 The result is placed in the square matrix m3 = m1 *
* @return long The time in the number of milliseconds for the mutiple to complete
*
*/
public long analyzeMultiply(double [][] m1, double[][] m2, double [][] m3);
/**
* @param double[][] m1 The square matrix to take the inverse of
*
* @param double[][] m2 The resultant inverse
*
* @return long The time in the number of milliseconds for the multiple to complete
*
*/
public long analyzeInverse(double [][] m1, double[][] m2);

}

Create a class called MatrixOperations that implements MatrixAnalysis. Note that if you do not intend to do the bonus problem, you may throw a not implemented exception for the analyzelnverse method. For the analyze Multiply method, implement the multiply method using the standard O(na) algorithm you learned in school and use it to do the following. a) Write a main method that determines the first size of input number of rows in the array) required to make the algorithm run for at least 1000 milliseconds. To do this you must first start with an array of size of 1 and then double the size til you have a running time greater than 1000 milliseconds. The use a binary search to determine the exact size that is over 1000 miliseconds, but size-1 is under. All input should be a matrix filled with random data. b) rite a main method that outputs the times 20 "equally spaced sizes between 1 and the size determined in part a c Graph the result from part b and determine the best fit curve of poly nomial degree 3. Note that Excel contains an easy way to so this and nicely display the equation, but you may use other curve fitting pro- grams if you wish. Google "excel curve fitting" may give many good results for how to do this d) Provide a pdf document that shows the graph and equation from part c and discuss your results.

Explanation / Answer

import java.util.ArrayList;

public interface sortAnalysis<E extends Comparable<? super E>> {

/**

* Sorts the list of elements and returns the amount of time required to sort them. (in milliseconds)
* @param list
* A list of comparable elements to be sorted and analyzed.
* @return list The time required to sort the list.
*/
public long analyzeSort(ArrayList<E> list);
}

public interface MatrixAnalysis {
/**
* @param double[][] m1 The first square matrix to multiply
* @param double[][] m2 The second square matrix to multiply
* @param double[][] m3 The result is placed in the square matrix m3 = m1 *
* @return long The time in the number of milliseconds for the mutiple to complete
*
*/
public long analyzeMultiply(double [][] m1, double[][] m2, double [][] m3);
/**
* @param double[][] m1 The square matrix to take the inverse of
*
* @param double[][] m2 The resultant inverse
*
* @return long The time in the number of milliseconds for the multiple to complete
*
*/
public long analyzeInverse(double [][] m1, double[][] m2);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote