tree

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RBTree

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

RBTree 简单的封装一下红黑树

func NewRBTree

func NewRBTree[K any, V any](compare ekit.Comparator[K]) (*RBTree[K, V], error)

func (*RBTree[K, V]) Add

func (rb *RBTree[K, V]) Add(key K, value V) error

Add 增加节点

func (*RBTree[K, V]) Delete

func (rb *RBTree[K, V]) Delete(key K) (V, bool)

Delete 删除节点

func (*RBTree[K, V]) Find

func (rb *RBTree[K, V]) Find(key K) (V, error)

Find 查找节点

func (*RBTree[K, V]) KeyValues

func (rb *RBTree[K, V]) KeyValues() ([]K, []V)

KeyValues 获取红黑树所有节点K,V

func (*RBTree[K, V]) Set

func (rb *RBTree[K, V]) Set(key K, value V) error

Set 修改节点

func (*RBTree[K, V]) Size

func (rb *RBTree[K, V]) Size() int

Size 返回红黑树结点个数

Jump to

Keyboard shortcuts

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