trie

package module
v0.0.0-...-9ee8f4a Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: MIT Imports: 0 Imported by: 1

README

trie

go trie package

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Children []*Node
}

func (*Container) FindByCharacter

func (c *Container) FindByCharacter(b byte) *Node

Finds a direct child node of a container by character

func (*Container) Insert

func (c *Container) Insert(s string)

Inserts the string into the container

func (*Container) Lookup

func (c *Container) Lookup(s string) *Node

Looks up the string in the container by walking through it and returns the last node that it walked past or nil if the container is the trie root and it did not find any matching child

type Node

type Node struct {
	Character byte
	Leaf      bool // node is the end of an inserted string
	Container
}

type Trie

type Trie struct {
	Container
}

Jump to

Keyboard shortcuts

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