avl

package
v0.0.0-...-a3940bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

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 NewAVLTree(less func(interface{}, interface{}) bool) *AVLTree

func NewFloat64AVLTree

func NewFloat64AVLTree() *AVLTree

func NewIntAVLTree

func NewIntAVLTree() *AVLTree

func NewStringAVLTree

func NewStringAVLTree() *AVLTree

func (*AVLTree) Cap

func (tree *AVLTree) Cap() int

func (*AVLTree) Clone

func (tree *AVLTree) Clone() *AVLTree

func (*AVLTree) Insert

func (tree *AVLTree) Insert(v interface{}) *AVLTreeNode

func (*AVLTree) IsEmpty

func (tree *AVLTree) IsEmpty() bool

func (*AVLTree) IsFull

func (tree *AVLTree) IsFull() bool

func (*AVLTree) Len

func (tree *AVLTree) Len() int

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL