MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / dfs1

Method dfs1

src/class122/Code01_MaxFlow2.java:81–103  ·  view source on GitHub ↗
(int root)

Source from the content-addressed store, hash-verified

79 }
80
81 public static void dfs1(int root) {
82 stackSize = 0;
83 push(root, 0, -1);
84 while (stackSize > 0) {
85 pop();
86 if (e == -1) {
87 deep[u] = deep[f] + 1;
88 stjump[u][0] = f;
89 for (int p = 1; p <= power; p++) {
90 stjump[u][p] = stjump[stjump[u][p - 1]][p - 1];
91 }
92 e = head[u];
93 } else {
94 e = next[e];
95 }
96 if (e != 0) {
97 push(u, f, e);
98 if (to[e] != f) {
99 push(to[e], u, -1);
100 }
101 }
102 }
103 }
104
105 public static int lca(int a, int b) {
106 if (deep[a] < deep[b]) {

Callers 1

mainMethod · 0.95

Calls 2

pushMethod · 0.95
popMethod · 0.95

Tested by

no test coverage detected