Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key interface { // Compare gives the result of a 3-way comparison // a.Compare(b) = 1 => a > b // a.Compare(b) = 0 => a == b // a.Compare(b) = -1 => a < b Compare(k Key) int }
Key represents key of Tree.
type Tree ¶
Tree is an implementation of Left-learning Red-Black Tree. Original paper on Left-leaning Red-Black Trees: http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf
Invariant 1: No red node has a red child Invariant 2: Every leaf path has the same number of black nodes Invariant 3: Only the left child can be red (left leaning)
func (*Tree[K, V]) Floor ¶
func (t *Tree[K, V]) Floor(key K) (K, V)
Floor returns the greatest key less than or equal to the given key.
Click to show internal directories.
Click to hide internal directories.