Ternary search tree collection in rust with similar API to std::collections as it possible.
Ternary search tree is a type of trie (sometimes called a prefix tree) where nodes are arranged in a manner similar to a binary search tree, but with up to three children rather than the binary tree's limit of two. Like other prefix trees, a ternary search tree can be used as an associative map structure with the ability for incremental string search. However, ternary search trees are more space efficient compared to standard prefix trees, at the cost of speed. Common applications for ternary search trees include spell-checking and auto-completion. TSTMap and TSTSet structures for map and set like usage.
Documentation is available at http://billyevans.github.io/tst/tst
It has special methods:
- wildcard_iter/wildcard_iter_mut - get iterator by wildcard
- prefix_iter/prefix_iter_mut - get iterator by prefix
- longest_prefix - get longest prefix
Add this to your
Iterating over keys with wildcard
Itereting over keys with common prefix
Search for longest prefix in the tree
TST is distributed under the terms of the MIT license.