trie

package
v0.0.0-...-528fb2d Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package trie provides a SuffixTrie data structure that can be used to index data by suffixes of strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SuffixTrie

type SuffixTrie[T any] struct {
	// contains filtered or unexported fields
}

SuffixTrie represents a trie data structure for suffixes

func NewSuffixTrie

func NewSuffixTrie[T any]() *SuffixTrie[T]

NewSuffixTrie creates a new SuffixTrie

func (*SuffixTrie[T]) Delete

func (t *SuffixTrie[T]) Delete(suffix string)

Delete deletes a suffix from the SuffixTrie

func (*SuffixTrie[T]) Get

func (t *SuffixTrie[T]) Get(key string) (*T, bool)

Get returns the value for the first suffix that matches the given key Example: if the trie contains the suffixes "foo" and "foobar" and the key is "foobarbaz", the value for "foo" will be returned

func (*SuffixTrie[T]) Insert

func (t *SuffixTrie[T]) Insert(suffix string, value *T)

Insert stores the value for a given suffix

Jump to

Keyboard shortcuts

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