summaryrefslogtreecommitdiff
path: root/graph/LCA_sparse.cpp
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-02-27 23:14:30 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2024-02-27 23:14:30 +0100
commitffa3fde34b667dff3ffe011e1f80f43ee02d2f82 (patch)
tree7d453b81151e0680767a1577d7441f0d1ca1de8e /graph/LCA_sparse.cpp
parent4979378b4b22d1db9a972e7f576cdcb94d79e7e0 (diff)
add LCA test and remove unused parent in DFS
Diffstat (limited to 'graph/LCA_sparse.cpp')
-rw-r--r--graph/LCA_sparse.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/graph/LCA_sparse.cpp b/graph/LCA_sparse.cpp
index 2a864c0..0f2fe22 100644
--- a/graph/LCA_sparse.cpp
+++ b/graph/LCA_sparse.cpp
@@ -13,13 +13,13 @@ struct LCA {
st.init(&depth);
}
- void dfs(vector<vector<int>>& adj, int v, ll d=0, int p=-1) {
+ void dfs(vector<vector<int>>& adj, int v, ll d=0) {
visited[idx] = v, depth[idx] = d;
first[v] = min(idx, first[v]), idx++;
for (int u : adj[v]) {
if (first[u] == 2 * sz(adj)) {
- dfs(adj, u, d + 1, v);
+ dfs(adj, u, d + 1);
visited[idx] = v, depth[idx] = d, idx++;
}}}