bst

package
v1.5.22 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNotFound = fmt.Errorf("not found")

ErrorNotFound is returned when a key is not in the binary search tree

Functions

This section is empty.

Types

type BSTree

type BSTree struct {
	// contains filtered or unexported fields
}

BSTree represents a binary search tree

func (*BSTree) Delete

func (b *BSTree) Delete(k string) error

Delete removes a key and associated data from a binsary search tree

func (*BSTree) Iter

func (b *BSTree) Iter() <-chan Item

Iter provides an iterator to walk through the binary search tree

func (*BSTree) RIter added in v1.4.8

func (b *BSTree) RIter() <-chan Item

func (*BSTree) Upsert

func (b *BSTree) Upsert(key string, val interface{})

Upsert updates or inserts data associated to a given key

func (*BSTree) Value

func (b *BSTree) Value(key string) (interface{}, error)

Value returns the data associated with a given key

type Item

type Item struct {
	Key string
	Val interface{}
}

Item holds the key and value of a node to be returned by an iterator

Jump to

Keyboard shortcuts

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