Struct Trie

Source
pub struct Trie { /* private fields */ }

Implementations§

Source§

impl Trie

Source

pub fn new(char_size: usize) -> Self

Source

pub fn with_capacity(char_size: usize, capacity: usize) -> Self

Source

pub fn insert_once_at(&mut self, node: usize, ch: usize) -> usize

Examples found in repository?
crates/competitive/src/data_structure/trie.rs (line 43)
36    pub fn insert_at<I>(&mut self, mut node: usize, iter: I) -> Vec<usize>
37    where
38        I: IntoIterator<Item = usize>,
39    {
40        let mut path = Vec::new();
41        for ch in iter.into_iter() {
42            path.push(node);
43            node = self.insert_once_at(node, ch);
44        }
45        path.push(node);
46        path
47    }
Source

pub fn insert_at<I>(&mut self, node: usize, iter: I) -> Vec<usize>
where I: IntoIterator<Item = usize>,

Examples found in repository?
crates/competitive/src/data_structure/trie.rs (line 52)
48    pub fn insert<I>(&mut self, iter: I) -> Vec<usize>
49    where
50        I: IntoIterator<Item = usize>,
51    {
52        self.insert_at(0, iter)
53    }
Source

pub fn insert<I>(&mut self, iter: I) -> Vec<usize>
where I: IntoIterator<Item = usize>,

Source

pub fn find_at<I>(&self, node: usize, iter: I) -> Result<usize, usize>
where I: IntoIterator<Item = usize>,

Examples found in repository?
crates/competitive/src/data_structure/trie.rs (line 71)
67    pub fn find<I>(&self, iter: I) -> Result<usize, usize>
68    where
69        I: IntoIterator<Item = usize>,
70    {
71        self.find_at(0, iter)
72    }
Source

pub fn find<I>(&self, iter: I) -> Result<usize, usize>
where I: IntoIterator<Item = usize>,

Source

pub fn next_node(&self, node: usize, ch: usize) -> Option<usize>

Examples found in repository?
crates/competitive/src/data_structure/trie.rs (line 89)
84    pub fn edges(&self) -> Vec<(usize, usize)> {
85        let mut edges = Vec::with_capacity(self.node_size - 1);
86        let mut stack = vec![0usize];
87        while let Some(node) = stack.pop() {
88            for ch in (0..self.char_size).rev() {
89                if let Some(nnode) = self.next_node(node, ch) {
90                    edges.push((node, nnode));
91                    stack.push(nnode);
92                }
93            }
94        }
95        edges
96    }
Source

pub fn node_size(&self) -> usize

Source

pub fn edges(&self) -> Vec<(usize, usize)>

Source

pub fn build_failure<M>(&mut self, dp: &mut [M::T])
where M: Monoid,

Trait Implementations§

Source§

impl Clone for Trie

Source§

fn clone(&self) -> Trie

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trie

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Trie

§

impl RefUnwindSafe for Trie

§

impl Send for Trie

§

impl Sync for Trie

§

impl Unpin for Trie

§

impl UnwindSafe for Trie

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.