MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / remove

Method remove

structure/trie/trie.go:76–89  ·  view source on GitHub ↗

remove lazily a word from the Trie node, no node is actually removed.

(s string)

Source from the content-addressed store, hash-verified

74
75// remove lazily a word from the Trie node, no node is actually removed.
76func (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.
92func (n *Node) Remove(s ...string) {

Callers 1

RemoveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected