¡@

Home 

python Programming Glossary: make_trie

How to create a TRIE in Python

http://stackoverflow.com/questions/11015320/how-to-create-a-trie-in-python

up a simple trie in just a few lines. _end '_end_' def make_trie words ... root dict ... for word in words ... current_dict root.. current_dict.setdefault _end _end ... return root ... make_trie 'foo' 'bar' 'baz' 'barz' 'b' 'a' 'r' '_end_' '_end_' 'z' '_end_'.. ... return True ... else ... return False ... in_trie make_trie 'foo' 'bar' 'baz' 'barz' 'baz' True in_trie make_trie 'foo'..