goTrie

package module
v0.0.0-...-46e60ff Latest Latest
Warning

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

Go to latest
Published: May 25, 2016 License: MIT Imports: 1 Imported by: 0

README

goTrie

Simple implementation of Trie data structure

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 defines a Trie node representation

func New

func New() *Trie

New initializes new Trie object with attributes default values

func (*Trie) Add

func (t *Trie) Add(s string) bool

Add adds a string to the Trie datastructure

func (*Trie) Children

func (t *Trie) Children() uint32

Children returns number of different suffixes, starting from this node.

func (*Trie) Get

func (t *Trie) Get(s string) *Trie

Get checks if the string is a word stored in the Trie datastructure.

func (*Trie) GetWordsFromPrefix

func (t *Trie) GetWordsFromPrefix(s string) []string

GetWordsFromPrefix returns list of words starting with provided prefix

func (*Trie) Has

func (t *Trie) Has(s string) bool

Has looks for a word and return True if the word is present, false otherwise.

func (*Trie) IsWord

func (t *Trie) IsWord() bool

IsWord returns true if the node is also indicator for a whole word, false otherwise

Jump to

Keyboard shortcuts

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