Documentation ¶
Index ¶
- type Btree
- func (t *Btree[T]) Ascend(iterator NodeIterator[T])
- func (t *Btree[T]) Contains(value T) bool
- func (t *Btree[T]) ContainsAll(values []T) bool
- func (t *Btree[T]) ContainsAny(values []T) bool
- func (t *Btree[T]) Debug()
- func (t *Btree[T]) Delete(value T) *Btree[T]
- func (t *Btree[T]) DeleteAll(values []T) *Btree[T]
- func (t *Btree[T]) Descend(iterator NodeIterator[T])
- func (t *Btree[T]) Empty() bool
- func (t *Btree[T]) Get(value T) *T
- func (t *Btree[T]) Head() *T
- func (t *Btree[T]) Init() *Btree[T]
- func (t *Btree[T]) Insert(value T) *Btree[T]
- func (t *Btree[T]) InsertAll(values []T) *Btree[T]
- func (t *Btree[T]) Len() int
- func (t *Btree[T]) Match(cond T) []T
- func (t *Btree[T]) NotEmpty() bool
- func (t *Btree[T]) Pop() *T
- func (t *Btree[T]) Pull() *T
- func (t *Btree[T]) String() string
- func (t *Btree[T]) Tail() *T
- func (t *Btree[T]) Values() []T
- type Node
- type NodeIterator
- type Val
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Btree ¶
type Btree[T Val[T]] struct { // contains filtered or unexported fields }
Btree represents an AVL tree
func (*Btree[T]) Ascend ¶
func (t *Btree[T]) Ascend(iterator NodeIterator[T])
Ascend performs an ascending order traversal of the tree calling the iterator function on each node the iterator will continue as long as the NodeIterator returns true
func (*Btree[T]) ContainsAll ¶
ContainsAll returns true if the tree contains all of the values
func (*Btree[T]) ContainsAny ¶
ContainsAny returns true if the tree contains any of the values
func (*Btree[T]) Debug ¶
func (t *Btree[T]) Debug()
Debug prints out useful debug information about the tree for debugging purposes
func (*Btree[T]) DeleteAll ¶
DeleteAll deletes the nodes from the tree associated with the search values
func (*Btree[T]) Descend ¶
func (t *Btree[T]) Descend(iterator NodeIterator[T])
Descend performs a descending order traversal of the tree using the iterator the iterator will continue as long as the NodeIterator returns true
func (*Btree[T]) Get ¶
func (t *Btree[T]) Get(value T) *T
Get returns the node value associated with the search value
func (*Btree[T]) InsertAll ¶
InsertAll inserts all the values into the tree and returns the tree pointer
func (*Btree[T]) Pop ¶
func (t *Btree[T]) Pop() *T
Pop deletes the last node from the tree and returns its value
func (*Btree[T]) Pull ¶
func (t *Btree[T]) Pull() *T
Pull deletes the first node from the tree and returns its value
type Node ¶
type Node[T Val[T]] struct { Value T // contains filtered or unexported fields }
Node represents a node in the tree with a value, left and right children, and a height/balance of the node.
func (*Node[T]) Debug ¶
func (n *Node[T]) Debug()
Debug prints out useful debug information about the tree node for debugging purposes
type NodeIterator ¶
NodeIterator expresses the iterator function used for traversals