type Node struct {
val rune
path string
term bool
depth int
meta interface{}
mask uint64
parent *Node
children map[rune]*Node
termCount int
}
hello derekparker:
I don't understand the function of the field mask in the Node, could you explain it? And why this trie is so fast. Thank you so much!
The mask is so that we can ensure all characters we are searching before are present in the subtree so that the algorithm can stop early if not, it's just an optimization.
hello derekparker: I don't understand the function of the field mask in the Node, could you explain it? And why this trie is so fast. Thank you so much!