trie

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 3 Imported by: 0

Documentation ΒΆ

Overview ΒΆ

Package trie provides structure with Unicode keys could hold this one (πŸ¦ƒ) --> (πŸ–) --> (🌯)

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

This section is empty.

Types ΒΆ

type Trie ΒΆ

type Trie[V any] struct {
	// contains filtered or unexported fields
}

func New ΒΆ

func New[V any]() *Trie[V]

func NewFromMap ΒΆ

func NewFromMap[V any](values map[string]V) *Trie[V]

func (*Trie[V]) Clear ΒΆ

func (t *Trie[V]) Clear()

Clear removes all elements.

func (*Trie[V]) Has ΒΆ

func (t *Trie[V]) Has(key string) bool

Has returns 'true' if the three has a node with not nil value.

func (*Trie[V]) Insert ΒΆ

func (t *Trie[V]) Insert(key string, value V)

Insert adds element to the three.

func (*Trie[V]) Len ΒΆ

func (t *Trie[V]) Len() int

Len returns number of values.

func (*Trie[V]) NodeLen ΒΆ

func (t *Trie[V]) NodeLen() int

NodeLen returns number of nodes (with value and without).

func (*Trie[V]) Remove ΒΆ

func (t *Trie[V]) Remove(key string) (res V, exists bool)

Remove removes node with value if exists. Also remove all empty upper nodes.

func (*Trie[V]) Search ΒΆ

func (t *Trie[V]) Search(key string) (res V, exists bool)

Search finds a node with value. If there is no node returns default value and 'false'.

Jump to

Keyboard shortcuts

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