Help Testing My Homework Code
I have the following homework assignment:
Implement a matrix abstract data type which doesnt allocate memory for 0 values. This is useful for sparse matrices, where many of the values in the matrix are zero. Use linked lists to implement the matrix class.
I made a very crude test case to test my solution: Basically I need for there to be a file called "file.txt" at the root level of your C: drive and the file will look like this:
0 0 0 9
1 0 0 0
2 0 0 0
1 0 0 0
basically representing a sparse matrix. Per the assignment, we were supposed to iimplement a LinkedList for our MatrixClass, so I tried to do that (hopefully). So when you run my program, it will ask you to input 2 numbers. You can put in any 2 (from 0 to 4) but the idea is that you are going to get back the node value of an element in my LinkedArrayList. So for instance, in the example above, if we wanted to get the 9 value sent to us, when you run my program, put in '1 1', as we want the first linked list, and the 9 is going to be the first value (node) in the linked list because everything preceding it in its row is 0. If we wanted the 2, you put in '3 1', etc. I just want to see if I could get some opinions on if I'm taking the right approach.