Question: Java Language - Write a program that uses a recursive algorithm to calculate the determinant of a matrix. Your matrix implementation should be that of

Java Language - Write a program that uses a recursive algorithm to calculate the determinant of a matrix.
Your matrix implementation should be that of a "sparse" matrix. Only matrix elements that are non-zero should be allocated in memory. 2D Arrays are not allowed - Preferred Method is Linked List
Make sure to name your programmed class as "public class SparseMatrix" and create a constructor that creates a default matrix of size 5x5. This class SparseMatrix should implement the interface SparseInterface. The program should read a matrix, print it out, and calculate and print the determinant.

public interface SparseInterface { /* Should clear the matrix of all entries (make all entries 0) */ public void clear();
/* Sets maximum size of the matrix. Number of rows. It should also clear the matrix (make all elements 0) */ public void setSize(int size);
/* Adds an element to the row and column passed as arguments (overwrites if element is already present at that position). Throws an error if row/column combination is out of bounds. */ public void addElement(int row, int col, int data);
/* Remove (make 0) the element at the specified row and column. Throws an error if row/column combination is out of bounds. */ public void removeElement(int row, int col);
/* Return the element at the specified row and column Throws an error if row/column combination is out of bounds. */ public int getElement(int row, int col);
/* Returns the determinant of the matrix calculated recursively (Use the formula provided in the project description). */ public int determinant();
/* Returns a new matrix which is the minor of the original (See project description for minor definition). */ public SparseInterface minor(int row, int col);
/* Should return the nonzero elements of your sparse matrix as a string. The String should be k lines, where k is the number of nonzero elements. Each line should be in the format "row column data" where row and column are the "coordinate" of the data and all are separated by spaces. An empty matrix should return an empty string. The print should be from left to right and from top to bottom (like reading a book) i.e. the matrix 3 0 1 0 2 0 0 0 4 Should print as: // Row Column Data // R C D 0 0 3 0 2 1 1 1 2 2 2 4 */ public String toString();
/* Should return the size of the matrix. */ public int getSize(); }
Recursive Determinant of a Sparse Matrix Recursive Determinant of a Sparse Matrix
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
