Documentation
¶
Index ¶
Constants ¶
const BranchingFactor uint = 257
Branch on byte plus special terminal character
const TerminalChar = 0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
type Branch struct {
// contains filtered or unexported fields
}
A Branch or internal node consists of an index which is the index of the key byte on which this branch 'decides'. A Branch implements a sparse array of children with one possible slot for each possible character branch. The Leaf node, Leaf[K,V], for a particular key can be found under the subtree rooted at the child in position C when charAt(K[Branch.index]) == C.
type HeightNode ¶
type Node ¶
We model Node as a sum type. Either Node should be nil, contain just a non-nil Branch, or contain just a non-nil Leaf
func (*Node) BreadthFirstSearch ¶
func (tn *Node) BreadthFirstSearch(callback func(*HeightNode) error) error
func (*Node) Descend ¶
Descend implements the basic traversal of the trie. It returns the deepest directed edge, parent --char--> child, accessible by following key on each critical index along the path of Branches. child may be nil indicating the slot for char on branch is unoccupied. Note: we use the Node container for branch as a convenience for mutation - it is guaranteed to be a Branch Node