pub struct HLD { /* private fields */ }
Expand description
重軽分解
Implementations§
Source§impl HLD
impl HLD
Sourcepub fn new<E: TreeEdgeTrait>(tree: &Tree<E>, root: usize) -> Self
pub fn new<E: TreeEdgeTrait>(tree: &Tree<E>, root: usize) -> Self
Time complexity $O(n)$
Space complexity $O(n)$
Sourcepub fn path_query_vertex<F>(&self, x: usize, y: usize, f: F)
pub fn path_query_vertex<F>(&self, x: usize, y: usize, f: F)
頂点x
から頂点y
へ向かうパス上の頂点についてのクエリを扱う。
演算は可換性を仮定する。
Time complexity $O(\log n)$
Sourcepub fn path_query_vertex_non_commutative<LFunc, RFunc>(
&self,
x: usize,
y: usize,
f: LFunc,
g: RFunc,
)
pub fn path_query_vertex_non_commutative<LFunc, RFunc>( &self, x: usize, y: usize, f: LFunc, g: RFunc, )
頂点x
から頂点y
へ向かうパス上の頂点についてのクエリを扱う。
Time complexity $O(\log n)$
Sourcepub fn path_query_edge<F>(&self, x: usize, y: usize, f: F)
pub fn path_query_edge<F>(&self, x: usize, y: usize, f: F)
頂点x
から頂点y
へ向かうパス上の辺についてのクエリを扱う。
Time complexity $O(\log n)$
Sourcepub fn subtree_query_vertex<F>(&self, x: usize, f: F)
pub fn subtree_query_vertex<F>(&self, x: usize, f: F)
頂点x
の部分木の頂点についてのクエリを扱う。
Time complexity $O(1)$
Sourcepub fn subtree_query_edge<F>(&self, x: usize, f: F)
pub fn subtree_query_edge<F>(&self, x: usize, f: F)
頂点x
の部分木の辺についてのクエリを扱う。
Time complexity $O(1)$
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HLD
impl RefUnwindSafe for HLD
impl Send for HLD
impl Sync for HLD
impl Unpin for HLD
impl UnwindSafe for HLD
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more