avl source pure
2
4
type ITree
interface 1type ITree interface {
2 Size() int
3 Has(key string) bool
4 Get(key string) any
5 GetByIndex(index int) (key string, value any)
6 Iterate(start, end string, cb IterCbFn) bool
7 ReverseIterate(start, end string, cb IterCbFn) bool
8 IterateByOffset(offset int, count int, cb IterCbFn) bool
9 ReverseIterateByOffset(offset int, count int, cb IterCbFn) bool
10
11 Set(key string, value any) (updated bool)
12 Remove(key string) (value any, removed bool)
13}type IterCbFn
functype Node
struct1type Node struct {
2 key string // key is the unique identifier for the node.
3 value any // value is the data stored in the node.
4 height int8 // height is the height of the node in the tree.
5 size int // size is the number of leaf nodes (key-value pairs) in the subtree rooted at this node.
6 leftNode *Node // leftNode is the left child of the node.
7 rightNode *Node // rightNode is the right child of the node.
8}Methods on Node
func Get
method on Nodefunc GetByIndex
method on Nodefunc Has
method on Nodefunc IsLeaf
method on Nodefunc Iterate
method on Nodefunc Key
method on Nodefunc Remove
method on Nodefunc ReverseIterate
method on Nodefunc Set
method on Nodefunc Size
method on Nodefunc TraverseByOffset
method on Nodefunc TraverseInRange
method on Nodefunc Value
method on Nodetype Tree
structMethods on Tree
func Get
method on Treefunc GetByIndex
method on Treefunc Has
method on Treefunc Iterate
method on Treefunc IterateByOffset
method on Treefunc Remove
method on Treefunc ReverseIterate
method on Treefunc ReverseIterateByOffset
method on Treefunc Set
method on Treefunc Size
method on TreeImports 0
Imports nothing.
/p/g1wx60nkcp5lfsxmedeg7sfs47tzxkath05u63t4/avl