trie

package
v1.7.16 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: Apache-2.0 Imports: 0 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
}

A simple trie implementation with Add an HasPrefix methods only.

func New

func New(list []string) Trie

New creates a Trie and add all strings in the provided list to it.

func (*Trie) Add

func (t *Trie) Add(v string)

Add adds a word to this trie

func (*Trie) GetPrefix

func (t *Trie) GetPrefix(v string) (string, bool)

GetPrefix is like HasPrefix but return the prefix in case of match or empty string otherwise.

func (*Trie) HasPrefix

func (t *Trie) HasPrefix(v string) bool

HasPrefix returns true of v has any of the prefixes stored in this trie.

Jump to

Keyboard shortcuts

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