Documentation ¶
Overview ¶
Package bst provides a simple key-value pair accepting Bst implementation and a Keyless variant for user-defined key generation based on provided values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bst ¶
Bst is the simplest implementation of a binary search tree. It provides logarithmic O(log n) operation for insertion, deletion and search. This variant provides no self-balancing, so worst-case (insertion of a sequence e.g. 1, 2, 3...) the tree performs at the level of a linked list O(n).
type KeyFunc ¶
KeyFunc is a key generating function signature for Bst variants with no explicit keys.
type Keyless ¶
Keyless is essentially a wrapper over a normal Bst with user-provided key generation out of inserted values. The overhead is miniscule (~15-20 nanoseconds more per op in comparison to the ordinary variant).
func NewKeyless ¶
NewKeyless constructs a *Keyless[Key, Value] with a key generating function for ordering.
func (*Keyless[K, V]) Contains ¶
func (k *Keyless[K, V]) Contains(value V) bool
Contains implements obt.KeylessObt.Contains
func (*Keyless[K, V]) Delete ¶
func (k *Keyless[K, V]) Delete(value V) (removed bool)
Delete implements obt.KeylessObt.Delete