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

Method link

src/class196/Code06_Riddle1.java:66–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64
65 // 前后缀优化建图
66 public static void link() {
67 cntt++;
68 addEdge(cntt, arr[1] + n);
69 for (int i = 2; i <= w; i++) {
70 cntt++;
71 addEdge(cntt, arr[i] + n);
72 addEdge(arr[i], cntt - 1);
73 addEdge(cntt, cntt - 1);
74 }
75 cntt++;
76 addEdge(cntt, arr[w] + n);
77 for (int i = w - 1; i >= 1; i--) {
78 cntt++;
79 addEdge(cntt, arr[i] + n);
80 addEdge(arr[i], cntt - 1);
81 addEdge(cntt, cntt - 1);
82 }
83 }
84
85 // 递归版
86 public static void tarjan1(int u) {

Callers 1

mainMethod · 0.95

Calls 1

addEdgeMethod · 0.95

Tested by

no test coverage detected