trie

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: MIT Imports: 3 Imported by: 6

README

trie

Build Status Go Report Card GoDoc GitHub license gocover.io

Trie is a Trie Zipper Tree implementation in Golang.

ok  	github.com/wzshiming/trie	0.580s	coverage: 99.3% of statements

BenchmarkTrie_Get1-4   	58407358	      20.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkTrie_Put1-4   	11237943	       109 ns/op	       0 B/op	       0 allocs/op

License

Pouch is licensed under the MIT License. See LICENSE for the full license text.

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 is a trie tree implementation.

func NewTrie

func NewTrie() *Trie

NewTrie returns a new Trie.

func (*Trie) Get

func (m *Trie) Get(key []byte) (val []byte, next *mapping, finish bool)

Get returns the val in the trie for a key.

func (*Trie) Keys

func (t *Trie) Keys() [][]byte

Keys returns all key of Trie.

func (*Trie) Mapping

func (t *Trie) Mapping() (m *mapping)

Mapping gets the mapping for get only.

func (*Trie) Put

func (t *Trie) Put(key, val []byte) (finish bool)

Put sets the val in the trie for a key.

func (*Trie) String

func (t *Trie) String() string

String returns format trie in a friendly.

func (*Trie) Walk

func (t *Trie) Walk(f func(k, v []byte))

Walk calls f sequentially for each key and value present in the trie.

Jump to

Keyboard shortcuts

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