trie

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Trie

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

Trie implements a prefix-tree

func New

func New() *Trie

New creates a trie

func (*Trie) Add

func (trie *Trie) Add(word string)

Add adds word to trie

func (*Trie) Has

func (trie *Trie) Has(word string) bool

Has reports whether the trie contains the word

func (*Trie) HasPrefix

func (trie *Trie) HasPrefix(prefix string) bool

HasPrefix reports the trie has prefix

func (*Trie) Remove

func (trie *Trie) Remove(word string) bool

Remove removes word from trie

func (*Trie) Search

func (trie *Trie) Search(prefix string, limit int) []string

Search retrives words which has specified prefix

func (*Trie) SearchAppend

func (trie *Trie) SearchAppend(dst []string, prefix string, limit int) []string

SearchAppend likes Search but append words to dst

func (*Trie) String

func (trie *Trie) String() string

String returns trie as a string

func (*Trie) Stringify

func (trie *Trie) Stringify(options *tree.Options) string

String formats trie as a string

Jump to

Keyboard shortcuts

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