package
module
Version:
v0.2.2
Opens a new window with list of versions in this module.
Published: May 11, 2024
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 3
Opens a new window with list of known importers.
Documentation
¶
-
type Any
-
type Ordered
-
type Tree
-
func (t *Tree[K, V]) Delete(k K) (v V, ok bool)
-
func (t *Tree[K, V]) DeleteMax() (k K, v V, ok bool)
-
func (t *Tree[K, V]) DeleteMin() (k K, v V, ok bool)
-
func (t *Tree[K, V]) Get(k K) (v V, ok bool)
-
func (t *Tree[K, V]) Keys() []K
-
func (t *Tree[K, V]) Len() int
-
func (t *Tree[K, V]) Max() (k K, v V, ok bool)
-
func (t *Tree[K, V]) Min() (k K, v V, ok bool)
-
func (t *Tree[K, V]) Put(k K, v V) (ok bool)
-
func (t *Tree[K, V]) Range(fn func(K, V) bool)
-
func (t *Tree[K, V]) String() string
-
func (t *Tree[K, V]) Values() []V
Tree is a left-leaning red-black tree.
NewTree returns a new Tree.
func (t *Tree[K, V]) Delete(k K) (v V, ok bool)
Delete removes the key-value pair associated with the given key.
func (t *Tree[K, V]) DeleteMax() (k K, v V, ok bool)
DeleteMax removes the maximum key-value pair from the tree.
func (t *Tree[K, V]) DeleteMin() (k K, v V, ok bool)
DeleteMin removes the minimum key-value pair from the tree.
func (t *Tree[K, V]) Get(k K) (v V, ok bool)
Get returns the value associated with the given key.
func (t *Tree[K, V]) Keys() []K
Keys returns a slice of all keys in the tree in ascending order.
Len returns the number of key-value pairs in the tree.
func (t *Tree[K, V]) Max() (k K, v V, ok bool)
Max returns the maximum key-value pair in the tree.
func (t *Tree[K, V]) Min() (k K, v V, ok bool)
Min returns the minimum key-value pair in the tree.
func (t *Tree[K, V]) Put(k K, v V) (ok bool)
Put inserts a key-value pair into the tree.
func (t *Tree[K, V]) Range(fn func(K, V) bool)
Range calls fn for each key-value pair in the tree in ascending order.
func (t *Tree[K, V]) Values() []V
Values returns a slice of all values in the tree in ascending order.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.