MCPcopy Create free account
hub / github.com/MolinDeng/Princeton-algs4 / getSite

Method getSite

01Lab-Percolation/Percolation.java:33–37  ·  view source on GitHub ↗
(int row, int col)

Source from the content-addressed store, hash-verified

31
32 // calculate index for row col
33 private int getSite(int row, int col) {
34 if (row == 0) return 0;
35 if (row == gridSize + 1) col = 1;
36 return (row - 1) * gridSize + col;
37 }
38
39 private void validate(int p, String desc) {
40 if (p < 1 || p > gridSize)

Callers 3

openMethod · 0.95
isOpenMethod · 0.95
isFullMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected