Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub fn insert(trie: Trie, string: &str) -> Trie {
- match trie {
- Trie::Leaf => Trie::Node(vec![(string.to_owned(), Trie::Leaf)]),
- Trie::Node(mut children) => {
- if let Some((_label, _edge)) = search_prefix(&children, string) {
- return unimplemented!();
- }
- children.push((string.to_owned(), Trie::Leaf));
- Trie::Node(children)
- }
- }
- }
Add Comment
Please, Sign In to add comment