Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion library/dsu/kruskal_tree.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#pragma once
//! https://mzhang2021.github.io/cp-blog/kruskal/
//! requires n >= 1 (2*n-1 allocation underflows when n == 0)
//! @time O(n log n)
//! @space O(n)
struct kr_tree {
int id;
vi p;
vector<vi> g;
kr_tree(int n): id(n), p(2 * n, -1), g(2 * n) {}
kr_tree(int n): id(n), p(2 * n - 1, -1), g(2 * n - 1) {}
int f(int u) { return p[u] < 0 ? u : p[u] = f(p[u]); }
bool join(int u, int v) {
if ((u = f(u)) == (v = f(v))) return 0;
Expand Down
1 change: 1 addition & 0 deletions library/strings/manacher/manacher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//! string b a a b a
//! center 1 3 5 7
//!
//! requires n >= 1 (2*n-1 allocation underflows when n == 0)
//! @time O(n)
//! @space O(n)
vi manacher(const auto& s) {
Expand Down
1 change: 1 addition & 0 deletions library/strings/suffix_array/suffix_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
//! auto [sa1, sa_inv1, lcp1] = get_sa(s_vec, 100'001);
//! @endcode
//!
//! requires n >= 1 (lcp size n-1 underflows when n == 0)
//! @time O(nlogn + max_num)
//! @space O(n + max_num)
auto get_sa(const auto& s, int max_num) {
Expand Down
1 change: 1 addition & 0 deletions library/strings/suffix_array/suffix_array_short.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//! auto [sa1, sa_inv1, lcp1] = sa_short(s_vec);
//! @endcode
//! about 2-3x slower than KACTL
//! requires n >= 1 (lcp size n-1 underflows when n == 0)
//! @time O(n * log^2(n))
//! @space O(n)
auto sa_short(const auto& s) {
Expand Down
Loading