Question: Problem 1. (Model a Percolation System) To model a percolation system, create a data type Percolation in Percolation.java with the following API: Corner cases. By
Problem 1. (Model a Percolation System) To model a percolation system, create a data type Percolation in Percolation.java with the following API:

Corner cases.
By convention, the row and column indices i and j are integers between 0 and N 1, where (0, 0) is the upper-left site.
Throw a java.lang.IndexOutOfBoundsException if any argument to open() , isOpen() , or isFull() is outside its prescribed range.
The constructor should throw a java.lang.IllegalArgumentException if N 0.
Performance requirements.
The constructor should take time proportional to N 2 ; all methods should take constant time plus a constant number of calls to the union-find methods union() , find() , connected() , and count() .
--------------------------------------------------------------------------------------------------------------------------
And the result should look like this:

--------------------------------------------------------------------------------------------------------------------------
Here's input10.txt:
10 9 1 1 9 5 7 1 5 0 3 7 3 9 0 3 1 3 7 8 2 1 1 8 0 3 2 4 4 4 6 1 7 5 3 6 4 8 5 2 6 3 6 6 0 8 3 2 9 0 9 9 9 8 6 0 4 8 7 5 0 1 4 2 3 5 8 4 7 2 1 3 5 0 6 6 8 2 8 3 3 3 9 2 4 2 7 0 7 2 0 5 6 1 2 6 3 8 9 6 5 4 1 7 2 9 7 6 9 3 4 7 9
--------------------------------------------------------------------------------------------------------------------------
Here's input10-no.txt:
10 9 1 1 9 5 7 1 5 0 3 7 3 9 0 3 1 3 7 8 2 1 1 8 0 3 2 4 4 4 6 1 7 5 3 6 4 8 5 2 6 3 6 6 0 8 3 2 9 0 9
8 6 0 4 8 7 5 0 1 4 2 3 5 8 4 7 2 1 3 5 0 6 6 8 2 8 3 3 3 9 2 4 2 7 0 7 2 0 5 6 1 2 6 3 8 9 6 5 4 1 7 2 9 7 6 9 3 4 7 9
--------------------------------------------------------------------------------------------------------------------------
And here's what I have and the format should look like:



--------------------------------------------------------------------------------------------------------------------------
The only thing to do is just to replace the " . . . " to real code. Thanks.
method Percolation (int N) void open(int i, int j) boolean is0pen (int i, int j) boolean isFull(int i, int j) int numberOf OpenSites) boolean percolates ) description create an N-by-N grid, with all sites blocked open site (i,j) is site (i,j) open? is site (i,j) full? number of open sites does the system percolate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
