Returns true if there is any word in the trie that starts with the given prefix
(prefix string)
| 45 | |
| 46 | // Returns true if there is any word in the trie that starts with the given prefix |
| 47 | func (this *Trie) StartsWith(prefix string) bool { |
| 48 | return this.search(prefix, false) |
| 49 | } |
| 50 | |
| 51 | func (this *Trie) search(word string, needsEnd bool) bool { |
| 52 | curr := this.root |