September 2019
Intermediate to advanced
816 pages
18h 47m
English
Now, let's search for a word in a Trie:
In terms of code lines, we have the following:
public boolean contains(String word) { Node node = root; for (int i = 0; i < word.length(); i++) { char ch = word.charAt(i); node = node.getChildren().get(ch); if (node == null) { return false; } } return node.isWord();}