remove lazily a word from the Trie node, no node is actually removed.
(s string)
| 74 | |
| 75 | // remove lazily a word from the Trie node, no node is actually removed. |
| 76 | func (n *Node) remove(s string) { |
| 77 | if len(s) == 0 { |
| 78 | return |
| 79 | } |
| 80 | next, ok := n, false |
| 81 | for _, c := range s { |
| 82 | next, ok = next.children[c] |
| 83 | if !ok { |
| 84 | // word cannot be found - we're done ! |
| 85 | return |
| 86 | } |
| 87 | } |
| 88 | next.isLeaf = false |
| 89 | } |
| 90 | |
| 91 | // Remove zero, one or more words lazily from the Trie, no node is actually removed. |
| 92 | func (n *Node) Remove(s ...string) { |