package
module
Version:
v0.0.0-...-9899538
Opens a new window with list of versions in this module.
Published: Mar 21, 2024
License: GPL-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
RbTree
Generic Red-Black Tree written in Go with generics.
Documentation
¶
- Constants
-
type Tree
-
func (t *Tree[K, V]) Clear()
-
func (t *Tree[K, V]) Delete(key K)
-
func (t *Tree[K, V]) Empty() bool
-
func (t *Tree[K, V]) Find(key K) V
-
func (t *Tree[K, V]) FindIt(key K) *node[K, V]
-
func (t *Tree[K, V]) Insert(key K, value V)
-
func (t *Tree[K, V]) Iterator() *node[K, V]
-
func (t *Tree[K, V]) Size() int
type Tree[K Ordered, V any] struct {
}
Tree is a struct of red-black tree.
func NewTree[K Ordered, V any]() *Tree[K, V]
NewTree creates a new rbtree.
func (t *Tree[K, V]) Clear()
Clear destroys the rbtree.
func (t *Tree[K, V]) Delete(key K)
Delete deletes the node by key
Empty checks whether the rbtree is empty.
func (t *Tree[K, V]) Find(key K) V
Find finds the node and return its value.
func (t *Tree[K, V]) FindIt(key K) *node[K, V]
FindIt finds the node and return it as an iterator.
func (t *Tree[K, V]) Insert(key K, value V)
Insert inserts the key-value pair into the rbtree.
func (t *Tree[K, V]) Iterator() *node[K, V]
Iterator creates the rbtree's iterator that points to the minmum node.
Size returns the size of the rbtree.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.