Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Status

Trie

Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching in Python.

Trie

Usage

Node

  • val
  • children
  • parent
  • depth

Trie

  • Get Trie size:
trie.size
  • Create Trie:
trie = Trie()
  • Add key:
trie.add("test")
  • Remove key:
trie.remove("test")
  • Find key:
trie.find("test")
  • Dfs search alphabets:
trie.dfs()
  • Bfs search alphabets:
trie.bfs()
  • Traverse all tree
trie.traverse()
  • Prefix Search(if does not have this prefix, then return all value of tree)
trie.prefix_search("te")
  • Fast test for valid prefix:
trie.has_key_with_prefix("t")
  • get prefix of the word
trie.get_prefix("testing")  # 返回test
  • Cmp tree
trie1 == trie2
trie1 > trie2
trie1 < trie2
  • If item in trie
"test" in trie
  • Most used alphabet(property)
trie.most_used_alphabet
  • Least used alphabet(property)
trie.least_used_alphabet
  • Alphabet count
trie.alphabet_count()

To do

  • Fuzzy search
trie.fuzzy_search('es')
  • Longest word(property)
trie.longest_word
  • Shortest word(property)
trie.shortest_word
  • Testing Case(Big data)

Author

SkyRover

About

Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching in Python.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages