trie

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2020 License: BSD-3-Clause 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
}

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 TrieInterface added in v1.0.5

type TrieInterface 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 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