Documentation
¶
Index ¶
- type Trie
- func (t *Trie[V]) Delete(k string)
- func (t *Trie[V]) Get(k string) (v V)
- func (t *Trie[V]) GetWithBool(k string) (v V, found bool)
- func (t *Trie[V]) HasPrefix(k string) bool
- func (t *Trie[V]) Len() int
- func (t *Trie[V]) Set(k string, v V)
- func (t *Trie[V]) SetWithPrev(k string, v V) (prev V, replaced bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Trie ¶
type Trie[V any] struct { // contains filtered or unexported fields }
func (*Trie[V]) Delete ¶
删除有两种方法, 这里先选择第1种,后面有时间再压测下第二种效率如何 1.记录rune和节点,删除这个节点。如果是子节点,再回溯删除 2.声明一个parent指针,不记录过程节点,直接p = n.parent; p != nil; p=p.parent 回溯删除
func (*Trie[V]) GetWithBool ¶
func (*Trie[V]) SetWithPrev ¶
Click to show internal directories.
Click to hide internal directories.