Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/algorithmzuo/algorithm-journey
/ addEdge
Method
addEdge
src/class161/Code02_LCA1.java:34–38 ·
view source on GitHub ↗
(int u, int v)
Source
from the content-addressed store, hash-verified
32
public
static
int
[] top =
new
int
[MAXN];
33
34
public
static
void
addEdge(
int
u,
int
v) {
35
next[++cnt] = head[u];
36
to[cnt] = v;
37
head[u] = cnt;
38
}
39
40
// 递归版,C++可以通过,java会爆栈
41
public
static
void
dfs1(
int
u,
int
f) {
Callers
1
main
Method · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected