Size returns the number of words in the Trie
()
| 62 | |
| 63 | // Size returns the number of words in the Trie |
| 64 | func (n *Node) Size() int { |
| 65 | r := 0 |
| 66 | for _, c := range n.children { |
| 67 | r += c.Size() |
| 68 | } |
| 69 | if n.isLeaf { |
| 70 | r++ |
| 71 | } |
| 72 | return r |
| 73 | } |
| 74 | |
| 75 | // remove lazily a word from the Trie node, no node is actually removed. |
| 76 | func (n *Node) remove(s string) { |
no outgoing calls