I have an assignment where I have questions that ask for the following implementations:
insertAtRanks(Integer x, Integer y, Object o): insert a new element to be stored at position (x,y)
and
Object removeAtRanks(Integer x, Integer y): remove and return the element at position (x,y)
It already asked for the implementation of replaceAtRanks where I had to replace the element inside a position with a parameter.
So what I assume when inserting and removing elements, the matrix will increase and decrease in size, but my question is how?
For example
| 3 6|
| 2 5|
If I had to do an insert number 8 at position (1,1) will the following happen?
| 3 6|
| 2 8|
| null 5|
And if I had to remove the element at (1,1) afterwards will it go back to?
| 3 6|
| 2 5|
Edit:
I am using Java for the implementation, and I am using a 2 dimensional array of classes to represent the matrix.