Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvlTree ¶
type AvlTree struct {
Root *AvlTreeNode // 树根节点
}
AvlTree AVL树
func (*AvlTree) FindMaxValue ¶
func (tree *AvlTree) FindMaxValue() *AvlTreeNode
FindMaxValue 找出最大值的节点
func (*AvlTree) FindMinValue ¶
func (tree *AvlTree) FindMinValue() *AvlTreeNode
FindMinValue 找出最小值的节点
type AvlTreeNode ¶
type AvlTreeNode struct { Value int // 值 Times int // 值出现的次数 Height int // 该节点作为树根节点,树的高度,方便计算平衡因子 Left *AvlTreeNode // 左子树 Right *AvlTreeNode // 右字树 // contains filtered or unexported fields }
AvlTreeNode AVL节点
func LeftRightRotation ¶
func LeftRightRotation(node *AvlTreeNode) *AvlTreeNode
LeftRightRotation 先左后右旋操作
func RightLeftRotation ¶
func RightLeftRotation(node *AvlTreeNode) *AvlTreeNode
RightLeftRotation 先右后左旋操作
func (*AvlTreeNode) BalanceFactor ¶
func (node *AvlTreeNode) BalanceFactor() int
BalanceFactor 计算平衡因子
Click to show internal directories.
Click to hide internal directories.