Trie vs. suffix tree vs. suffix array

后端 未结 7 1032
春和景丽
春和景丽 2020-12-02 06:10

Which structure provides the best performance results; trie (prefix tree), suffix tree or suffix array? Are there other similar structures? What are good Java implementation

7条回答
  •  失恋的感觉
    2020-12-02 06:38

    Using Suffix Trees you can write something that will match your dictionary to your text in O(n+m+k) time where n is letters in your dictionary, m is letters in your text, and k is the number of matches. Tries are much slower for this. I'm not sure what a Suffix Array is, so I can't comment on that.

    That said, it's non-trivial to code and I don't happen to know of any Java libraries that provide the necessary functions.

提交回复
热议问题