diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-02-27 13:05:43 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-02-27 13:05:43 +0100 |
| commit | 19ad8dd96a237d4f55a58d9dc13fed0eea532641 (patch) | |
| tree | a105b7fafb1a56f330d5560bf3c98361311313c3 | |
| parent | e09410a14cee2ac5a6e415a4fc8233edcecdf82f (diff) | |
delete duplicate sparse table LCA
| -rw-r--r-- | graph/LCA.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/graph/LCA.cpp b/graph/LCA.cpp deleted file mode 100644 index 7debf8f..0000000 --- a/graph/LCA.cpp +++ /dev/null @@ -1,24 +0,0 @@ -vector<vector<int>> adj(); -vector<int> visited(); -vector<int> first(); -vector<int> depth(); - -void initLCA(int gi, int d, int& c) { - visited[c] = gi, depth[c] = d, first[gi] = min(c, first[gi]), c++; - for(int gn : adj[gi]) { - initLCA(gn, d+1, c); - visited[c] = gi, depth[c] = d, c++; -}} - -int getLCA(int a, int b) { - return visited[query(min(first[a], first[b]), max(first[a], first[b]))]; -} - -void exampleUse() { - int c = 0; - visited = vector<int>(2*sz(adj)); - first = vector<int>(sz(adj), 2*sz(adj)); - depth = vector<int>(2*sz(adj)); - initLCA(0, 0, c); - init(depth); -} |
