From ffa3fde34b667dff3ffe011e1f80f43ee02d2f82 Mon Sep 17 00:00:00 2001 From: Gloria Mundi Date: Tue, 27 Feb 2024 23:14:30 +0100 Subject: add LCA test and remove unused parent in DFS --- graph/LCA_sparse.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'graph/LCA_sparse.cpp') 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>& adj, int v, ll d=0, int p=-1) { + void dfs(vector>& 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++; }}} -- cgit v1.2.3