trie

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node trie tree node container carries value and children.

type Trie

type Trie struct {
	// contains filtered or unexported fields
}

Trie is a trie container.

func NewTrie

func NewTrie() *Trie

NewTrie create a new trie.

func (*Trie) Insert

func (t *Trie) Insert(key string)

Insert insert a key.

func (*Trie) Len

func (t *Trie) Len() int

Len returns trie size.

func (*Trie) MatchPrefix

func (t *Trie) MatchPrefix(key string) []string

MatchPrefix - prefix match.

func (*Trie) Root

func (t *Trie) Root() *Node

Root returns root node.

func (*Trie) Walk

func (t *Trie) Walk(node *Node) (ret []string)

Walk the tree, return the trie node value slice

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL