pub struct VebTree<T> { /* private fields */ }Expand description
A tree stored in van Emde Boas memory layout for cache-oblivious traversal.
Implementations§
Source§impl<T: Clone> VebTree<T>
impl<T: Clone> VebTree<T>
Sourcepub fn build(input: Vec<TreeNode<T>>) -> Self
pub fn build(input: Vec<TreeNode<T>>) -> Self
Build a VebTree from a list of logical tree nodes.
The first node in input whose id does not appear as any other
node’s child is treated as root. If input is empty, returns an
empty tree.
Sourcepub fn get(&self, id: u32) -> Option<&VebEntry<T>>
pub fn get(&self, id: u32) -> Option<&VebEntry<T>>
Look up a node by its original ID. O(1) via hash map.
Sourcepub fn get_by_index(&self, idx: u32) -> Option<&VebEntry<T>>
pub fn get_by_index(&self, idx: u32) -> Option<&VebEntry<T>>
Look up a node by its position in the flat array.
Sourcepub fn iter(&self) -> impl Iterator<Item = &VebEntry<T>>
pub fn iter(&self) -> impl Iterator<Item = &VebEntry<T>>
Iterate nodes in vEB order (cache-friendly traversal).
Sourcepub fn iter_dfs(&self) -> Vec<&VebEntry<T>>
pub fn iter_dfs(&self) -> Vec<&VebEntry<T>>
Iterate nodes in DFS pre-order (logical traversal order).
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for VebTree<T>
impl<T> RefUnwindSafe for VebTree<T>where
T: RefUnwindSafe,
impl<T> Send for VebTree<T>where
T: Send,
impl<T> Sync for VebTree<T>where
T: Sync,
impl<T> Unpin for VebTree<T>where
T: Unpin,
impl<T> UnsafeUnpin for VebTree<T>
impl<T> UnwindSafe for VebTree<T>where
T: UnwindSafe,
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