summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-11-20 01:54:02 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2024-11-20 01:54:02 +0100
commitfc6da254c57a94cda4c8f61b8d9daa507dcdfdda (patch)
tree403a83862810b585dfa28d211e0d8973cc589ea7 /content
parentc9365cd20105e36bae0b2145b69f94f6f93195d6 (diff)
rename sparse table query function: queryIdempotent -> query
Diffstat (limited to 'content')
-rw-r--r--content/datastructures/datastructures.tex2
-rw-r--r--content/datastructures/sparseTable.cpp2
-rw-r--r--content/graph/LCA_sparse.cpp2
3 files changed, 3 insertions, 3 deletions
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]]; }