Documentation ¶
Overview ¶
Package strtree8 implements red-black tree for key value pairs with string keys, uint8 values and custom comparison.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compare ¶
Compare defines function interface for custom comparison. Function implementing the interface should return value less than zero if its first argument precedes second one, zero if both are equal and positive if the second precedes.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a red-black tree for key-value pairs where key is string.
func NewTree ¶
func NewTree() *Tree
NewTree creates empty tree with default comparison operation (strings.Compare).
func NewTreeWithCustomComparison ¶
NewTreeWithCustomComparison creates empty tree with given comparison operation.
func (*Tree) Delete ¶
Delete removes node by given key. It returns copy of tree and true if node has been indeed deleted otherwise original tree and false.
func (*Tree) Enumerate ¶
Enumerate returns channel which is populated by key pair values in order of keys.
func (*Tree) InplaceInsert ¶
InplaceInsert inserts or replaces given key-value pair in the tree. The method inserts data directly to current tree so make sure you have exclusive access to it.