From fc6da254c57a94cda4c8f61b8d9daa507dcdfdda Mon Sep 17 00:00:00 2001 From: Gloria Mundi Date: Wed, 20 Nov 2024 01:54:02 +0100 Subject: rename sparse table query function: queryIdempotent -> query --- content/datastructures/datastructures.tex | 2 +- content/datastructures/sparseTable.cpp | 2 +- content/graph/LCA_sparse.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'content') diff --git a/content/datastructures/datastructures.tex b/content/datastructures/datastructures.tex index 0495543..c4bd312 100644 --- a/content/datastructures/datastructures.tex +++ b/content/datastructures/datastructures.tex @@ -58,7 +58,7 @@ \begin{algorithm}{Range Minimum Query} \begin{methods} \method{init}{baut Struktur auf}{n\*\log(n)} - \method{queryIdempotent}{Index des Minimums in $[l, r)$}{1} + \method{query}{Index des Minimums in $[l, r)$}{1} \end{methods} \begin{itemize} \item \code{better}-Funktion muss idempotent sein! diff --git a/content/datastructures/sparseTable.cpp b/content/datastructures/sparseTable.cpp index 44989ab..5455ef5 100644 --- a/content/datastructures/sparseTable.cpp +++ b/content/datastructures/sparseTable.cpp @@ -16,7 +16,7 @@ struct SparseTable { st[j + 1][i] = better(st[j][i] , st[j][i + (1 << j)]); }}} - int queryIdempotent(int l, int r) { + int query(int l, int r) { if (r <= l) return -1; int j = __lg(r - l); //31 - builtin_clz(r - l); return better(st[j][l] , st[j][r - (1 << j)]); diff --git a/content/graph/LCA_sparse.cpp b/content/graph/LCA_sparse.cpp index 22a9082..1da8876 100644 --- a/content/graph/LCA_sparse.cpp +++ b/content/graph/LCA_sparse.cpp @@ -25,7 +25,7 @@ struct LCA { int getLCA(int u, int v) { if (first[u] > first[v]) swap(u, v); - return visited[st.queryIdempotent(first[u], first[v] + 1)]; + return visited[st.query(first[u], first[v] + 1)]; } ll getDepth(int v) { return depth[first[v]]; } -- cgit v1.2.3