Documentation
¶
Index ¶
- Constants
- Variables
- type InsertOrUpdateCb
- type RBTree
- func (r *RBTree[K, V]) Delete(k K)
- func (r *RBTree[K, V]) First() (v V, ok bool)
- func (r *RBTree[K, V]) Get(k K) (v V)
- func (r *RBTree[K, V]) InsertOrUpdate(k K, v V, cb InsertOrUpdateCb[V])
- func (r *RBTree[K, V]) Last() (v V, ok bool)
- func (r *RBTree[K, V]) Len() int
- func (a *RBTree[K, V]) Range(callback func(k K, v V) bool)
- func (r *RBTree[K, V]) RangePrev(callback func(k K, v V) bool)
- func (r *RBTree[K, V]) Set(k K, v V)
- func (r *RBTree[K, V]) Swap(k K, v V) (prev V, replaced bool)
- func (r *RBTree[K, V]) TopMax(limit int, callback func(k K, v V) bool)
- func (r *RBTree[K, V]) TopMin(limit int, callback func(k K, v V) bool)
- func (r *RBTree[K, V]) TryGet(k K) (v V, ok bool)
Constants ¶
View Source
const ( RED color = 1 BLACK color = 2 )
Variables ¶
View Source
var ErrNotFound = errors.New("rbtree: not found value")
Functions ¶
This section is empty.
Types ¶
type InsertOrUpdateCb ¶ added in v0.1.1
type InsertOrUpdateCb[V any] func(prev V, new V) V
type RBTree ¶
type RBTree[K constraints.Ordered, V any] struct { // contains filtered or unexported fields }
红黑树
func (*RBTree[K, V]) InsertOrUpdate ¶ added in v0.1.1
func (r *RBTree[K, V]) InsertOrUpdate(k K, v V, cb InsertOrUpdateCb[V])
InsertOrUpdate inserts or updates an element in the RBTree
Click to show internal directories.
Click to hide internal directories.