Documentation ¶
Index ¶
- Constants
- type AVLTree
- func (tree *AVLTree) Cap() int
- func (tree *AVLTree) Clone() *AVLTree
- func (tree *AVLTree) Insert(v interface{}) *AVLTreeNode
- func (tree *AVLTree) IsEmpty() bool
- func (tree *AVLTree) IsFull() bool
- func (tree *AVLTree) Len() int
- func (tree *AVLTree) TraverseInOrder(consumer func(interface{}))
- func (tree *AVLTree) TraversePostOrder(consumer func(interface{}))
- func (tree *AVLTree) TraversePreOrder(consumer func(interface{}))
- type AVLTreeNode
- func (node *AVLTreeNode) Clone() *AVLTreeNode
- func (node *AVLTreeNode) Height() int
- func (node *AVLTreeNode) LeftChild() *AVLTreeNode
- func (node *AVLTreeNode) LeftHeight() int
- func (node *AVLTreeNode) RightChild() *AVLTreeNode
- func (node *AVLTreeNode) RightHeight() int
- func (node *AVLTreeNode) TraverseInOrder(consumer func(interface{}))
- func (node *AVLTreeNode) TraversePostOrder(consumer func(interface{}))
- func (node *AVLTreeNode) TraversePreOrder(consumer func(interface{}))
- func (node *AVLTreeNode) UpdateHeight()
- func (node *AVLTreeNode) Value() interface{}
Constants ¶
View Source
const ( DirNone flags = 0x0 DirLeft flags = 0x1 DirRight flags = 0x2 NodeCreated flags = 0x10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AVLTree ¶
type AVLTree struct {
// contains filtered or unexported fields
}
func NewAVLTree ¶
func NewFloat64AVLTree ¶
func NewFloat64AVLTree() *AVLTree
func NewIntAVLTree ¶
func NewIntAVLTree() *AVLTree
func NewStringAVLTree ¶
func NewStringAVLTree() *AVLTree
func (*AVLTree) Insert ¶
func (tree *AVLTree) Insert(v interface{}) *AVLTreeNode
func (*AVLTree) TraverseInOrder ¶
func (tree *AVLTree) TraverseInOrder(consumer func(interface{}))
func (*AVLTree) TraversePostOrder ¶
func (tree *AVLTree) TraversePostOrder(consumer func(interface{}))
func (*AVLTree) TraversePreOrder ¶
func (tree *AVLTree) TraversePreOrder(consumer func(interface{}))
type AVLTreeNode ¶
type AVLTreeNode struct {
// contains filtered or unexported fields
}
AVLTreeNode is a node of an AVL tree.
func NewAVLTreeNode ¶
func NewAVLTreeNode(childL, childR *AVLTreeNode, v interface{}) *AVLTreeNode
func (*AVLTreeNode) Clone ¶
func (node *AVLTreeNode) Clone() *AVLTreeNode
func (*AVLTreeNode) Height ¶
func (node *AVLTreeNode) Height() int
Height returns the height of this node, i.e. the maximum of its left height and right height. The height of a non-existing (nil) node is defined to be -1, while the height of a leaf node is 0.
func (*AVLTreeNode) LeftChild ¶
func (node *AVLTreeNode) LeftChild() *AVLTreeNode
LeftChild returns the left child of this node or nil.
func (*AVLTreeNode) LeftHeight ¶
func (node *AVLTreeNode) LeftHeight() int
LeftHeight returns the left height of this node.
func (*AVLTreeNode) RightChild ¶
func (node *AVLTreeNode) RightChild() *AVLTreeNode
RightChild returns the right child of this node or nil.
func (*AVLTreeNode) RightHeight ¶
func (node *AVLTreeNode) RightHeight() int
RightHeight returns the right height of this node.
func (*AVLTreeNode) TraverseInOrder ¶
func (node *AVLTreeNode) TraverseInOrder(consumer func(interface{}))
func (*AVLTreeNode) TraversePostOrder ¶
func (node *AVLTreeNode) TraversePostOrder(consumer func(interface{}))
func (*AVLTreeNode) TraversePreOrder ¶
func (node *AVLTreeNode) TraversePreOrder(consumer func(interface{}))
func (*AVLTreeNode) UpdateHeight ¶
func (node *AVLTreeNode) UpdateHeight()
UpdateHeight updates the heights of this node.
func (*AVLTreeNode) Value ¶
func (node *AVLTreeNode) Value() interface{}
Value returns the value stored with this node.
Click to show internal directories.
Click to hide internal directories.