trie

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	// Inserts a word into trie
	Insert(word []rune)

	// Searches for prefix in the trie, indicated by bool
	// if exist, returns metadata stored corresponding to last char
	Search(prefix []rune) (lib.Metadata, bool)

	// Searches for whole word in the trie,
	// returns true only if the word is added to trie before with all characters
	Contains(word []rune) bool
}

type Trie

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

func NewTrie

func NewTrie(updateMDataFunc UpdateMDataFunc) *Trie

func (*Trie) Contains

func (t *Trie) Contains(word []rune) bool

func (*Trie) Insert

func (t *Trie) Insert(word []rune)

func (*Trie) Search

func (t *Trie) Search(prefix []rune) (lib.Metadata, bool)

type UpdateMDataFunc

type UpdateMDataFunc func(char rune, word []rune, metadata lib.Metadata)

Jump to

Keyboard shortcuts

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