Question: / / Method to expand array public void expand ( int m , int n ) { int [ ] [ ] mazeCopy = maze;

//Method to expand array
public void expand(int m, int n){
int[][] mazeCopy = maze;
inIt(m, n);
for(int i =0; i < mazeCopy.length; i++){
System.arraycopy(mazeCopy[i],0, maze[i],0, mazeCopy[i].length);
}
}
write another class method called shrink similar to exand but where the new size of the table is actually smaller than the old one. It should have the same parameters as the functions expand, but the for loop should be bases on the new number of rows, and the nubmer of elements to be copied in the call to arrayCopy should be equal to the new number of columns.

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!