Skip to content

Instantly share code, notes, and snippets.

View Alxandr's full-sized avatar
⁉️
⁉️

Aleksander Heintz Alxandr

⁉️
⁉️
View GitHub Profile
class Percolation extends WeightedQuickUnionUF {
private int width;
public Percolation(int n) {
super(n * n + 2);
for(int i = 0; i < n; i++) {
union(1 + n * (n - 1) + i, n * n + 1);
}
width = n;
}