tree

package
v0.0.0-...-8fb26ab Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeIterator

type NodeIterator[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*NodeIterator[K, V]) Begin

func (i *NodeIterator[K, V]) Begin()

func (*NodeIterator[K, V]) End

func (i *NodeIterator[K, V]) End()

func (*NodeIterator[K, V]) First

func (i *NodeIterator[K, V]) First() bool

Note: you can immediately call Key() and Value() after calling First()

func (*NodeIterator[K, V]) Key

func (i *NodeIterator[K, V]) Key() K

func (*NodeIterator[K, V]) Last

func (i *NodeIterator[K, V]) Last() bool

Note: you can immediately call Key() and Value() after calling Last()

func (*NodeIterator[K, V]) Next

func (i *NodeIterator[K, V]) Next() bool

Note: this must be called first if we are at the beginning, otherwise it will panic

func (*NodeIterator[K, V]) Prev

func (i *NodeIterator[K, V]) Prev() bool

Note: this must be called first if we are at the end, otherwise it will panic

func (*NodeIterator[K, V]) Value

func (i *NodeIterator[K, V]) Value() V

type RedBlack

type RedBlack[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewRedBlack

func NewRedBlack[K comparable, V any](comparator func(a, b K) int) *RedBlack[K, V]

TODO - rely on custom red black tree implementation

func (*RedBlack[K, V]) Clear

func (t *RedBlack[K, V]) Clear()

func (*RedBlack[K, V]) Empty

func (t *RedBlack[K, V]) Empty() bool

func (*RedBlack[K, V]) Get

func (t *RedBlack[K, V]) Get(key K) (V, bool)

func (*RedBlack[K, V]) Iterator

func (t *RedBlack[K, V]) Iterator() NodeIterator[K, V]

func (*RedBlack[K, V]) Keys

func (t *RedBlack[K, V]) Keys() []K

func (*RedBlack[K, V]) Left

func (t *RedBlack[K, V]) Left() (V, bool)

func (*RedBlack[K, V]) Put

func (t *RedBlack[K, V]) Put(key K, value V)

func (*RedBlack[K, V]) Remove

func (t *RedBlack[K, V]) Remove(key K)

func (*RedBlack[K, V]) Right

func (t *RedBlack[K, V]) Right() (V, bool)

func (*RedBlack[K, V]) Size

func (t *RedBlack[K, V]) Size() int

func (*RedBlack[K, V]) Values

func (t *RedBlack[K, V]) Values() []V

Jump to

Keyboard shortcuts

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