trie

package
v0.0.0-...-4a09e47 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 3 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 Trie data type

func NewTrie

func NewTrie() *Trie

NewTrie Constructor for a Trie

func (*Trie) AddWord

func (t *Trie) AddWord(word string)

AddWord adds word to this Trie

func (*Trie) AutoComplete

func (t *Trie) AutoComplete(prefix string, wordCount int) string

AutoComplete returns a comma separated

func (*Trie) GetAllWords

func (t *Trie) GetAllWords() []string

GetAllWords returns all words, for testing and debugging

func (*Trie) GetWordsFor

func (t *Trie) GetWordsFor(prefix string) []WordData

GetWordsFor returns a list of words and word counts for prefix

func (*Trie) PrintAll

func (t *Trie) PrintAll()

PrintAll prints info about each word in this Trie, for testing and debugging

type WordData

type WordData struct {
	Word  string
	Count int
}

WordData used to return found words and their word count

Jump to

Keyboard shortcuts

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