Trie implementation

后端 未结 6 1934
醉梦人生
醉梦人生 2020-12-09 05:19

I am attempting to implement a very simple Trie in Java that supports 3 operations. I\'d like it to have an insert method, a has method (ie is a certain word in the trie),

6条回答
  •  甜味超标
    2020-12-09 05:46

    Maybe you can just use "Map c"instead of "TrieNode[] c", that would allow you to use this for all the types of characters uppercase/lowercase and even special characters and even would save you space ( allocating 26 character array at each character level )

提交回复
热议问题