Documentation ¶
Index ¶
- type BTree
- func (tr *BTree[T]) Ascend(pivot T, iter func(item T) bool)
- func (tr *BTree[T]) Delete(key interface{}) interface{}
- func (tr *BTree[T]) DeleteHint(key interface{}, hint *PathHint) interface{}
- func (tr *BTree[T]) Descend(pivot T, iter func(item T) bool)
- func (tr *BTree[T]) Get(key interface{}) interface{}
- func (tr *BTree[T]) GetHint(key interface{}, hint *PathHint) interface{}
- func (tr *BTree[T]) Height() int
- func (tr *BTree[T]) Len() int
- func (tr *BTree[T]) Less(a, b T) bool
- func (tr *BTree[T]) Load(item T) (T, bool)
- func (tr *BTree[T]) Max() (T, bool)
- func (tr *BTree[T]) Min() (T, bool)
- func (tr *BTree[T]) PopMax() (T, bool)
- func (tr *BTree[T]) PopMin() (T, bool)
- func (tr *BTree[T]) Set(item T) (prev T)
- func (tr *BTree[T]) SetHint(item T, hint *PathHint) (prev T)
- func (tr *BTree[T]) Walk(iter func(item []T))
- type PathHint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BTree ¶
type BTree[T comparable] struct { // contains filtered or unexported fields }
BTree is an ordered set items
func (*BTree[T]) Ascend ¶
Ascend the tree within the range [pivot, last] Pass nil for pivot to scan all item in ascending order Return false to stop iterating
func (*BTree[T]) Delete ¶
func (tr *BTree[T]) Delete(key interface{}) interface{}
Delete a value for a key
func (*BTree[T]) DeleteHint ¶
DeleteHint deletes a value for a key using a path hint
func (*BTree[T]) Descend ¶
Descend the tree within the range [pivot, first] Pass nil for pivot to scan all item in descending order Return false to stop iterating
func (*BTree[T]) Less ¶
Less is a convenience function that performs a comparison of two items using the same "less" function provided to New.
func (*BTree[T]) PopMax ¶
PopMax removes the minimum item in tree and returns it. Returns nil if the tree has no items.
func (*BTree[T]) PopMin ¶
PopMin removes the minimum item in tree and returns it. Returns nil if the tree has no items.