Trie (Prefix Tree) in Python

后端 未结 5 1222
情话喂你
情话喂你 2020-12-12 23:14

I don\'t know if this is the place to ask about algorithms. But let\'s see if I get any answers ... :)

If anything is unclear I\'m very happy to clarify things.

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-12 23:32

    Somewhat of a tangent, but if you are super worried about the number of nodes in your Trie, you may look at joining your word suffixes too. I'd take a look at the DAWG (Directed Acyclic Word Graph) idea: http://en.wikipedia.org/wiki/Directed_acyclic_word_graph

    The downside of these is that they aren't very dynamic and creating them can be difficult. But, if your dictionary is static, they can be super compact.

提交回复
热议问题