Question: Java Matrices: Write a program that reads in two matrices from two different text files. Should use a singly or double linked list to store

Java Matrices:

Write a program that reads in two matrices from two different text files. Should use a singly or double linked list to store the two matrices and perform the following operations on them:

- Add, Subtract, Mulitply, Transpose, and Determinant

Requirements:

Use singly or doubly linked list date structures only:

- No other library methods or existing collection framework.

- No use of Array, ArrayList, List, or Vectors for storing.

- No two-dimensional arrays.

- Input files can only be read Exactly Once for all operations.

For the determinant operation, you may augment your linked list node to retain row/column id and employ recursion to directly implement the standard method for computing determinant of a matrix. You are encouraged to design your own node representation (e.g., each node element has two pointers: one to its next right and another to its next bottom element that facilitate both horizontal and vertical traversals like one gets in a 2d array)

Inputs:

The program takes 3 or 4 arguments as input. Assuming input matrix are in space deliminated files a.txt and b.txt, an few examples of format operation query will be:

- Addition: add a.txt b.txt output.txt

- Transpose: tra a.txt output.txt

- Determinant: det a.txt output.txt

The input file can contains only integer (e.g. -3). However your output should be in floating point format with 1 decimal place (e.g. -3.0).

Example Input:

Input A

11 17 20 13 1 8 6 7 20 1 10 18 15 10 6 12 11 3 10 6 7 20 8 8 11

Input B

12 3 5 19 13 11 4 15 6 17 14 8 17 11 18 4 4 16 12 19 5 12 12 14 1

*Please include all operations when answering, especially the determinant. Also, make sure your code works with the provided matrices.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!