#trie #prefix-tree #retrieval-tree #digital-tree

dyn_trie

Dynamic trie is trie capable of mapping any T to any char iterator

14 stable releases

2.3.1 Feb 16, 2025
2.3.0 Feb 6, 2025
2.1.1 Jan 30, 2025
1.1.1 Jan 19, 2025
1.0.2 Jul 22, 2024

#1082 in Data structures

Download history 8/week @ 2024-10-31 6/week @ 2024-11-07 1/week @ 2024-11-14 2/week @ 2024-12-05 117/week @ 2024-12-12 8/week @ 2024-12-19 163/week @ 2025-01-09 150/week @ 2025-01-16 87/week @ 2025-01-23 517/week @ 2025-01-30 190/week @ 2025-02-06 85/week @ 2025-02-13

879 downloads per month

MIT license

59KB
1.5K SLoC

Dynamic Trie

Dynamic trie is trie that allows mapping of any T to any char iterator with asymptotical computational complexity based on that of std::collections::HashMap.

Node occurs for each char as defined by Rust language.

let mut trie = Trie::<char>::new();

let some = "información meteorológica".chars();
trie.ins('🌩', some.clone());

let one_more = "alimentación RSS".chars();
trie.ins('😋', one_more.clone());

assert_eq!(RemRes::Ok('😋'), trie.rem(one_more.clone()));
assert_eq!(AcqRes::Err(KeyErr::Unknown), trie.acq(one_more.clone()));
assert_eq!(AcqRes::Ok(&'🌩'), trie.acq(some.clone()));

lib.rs:

Dynamic trie in contrast to classic trie does not have fixed size alphabet associated with node.

Each node has dynamic alphabet of size as to satisfy exactly associated branches.

No runtime deps