avl

package
v0.0.0-...-5cc1d31 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 1 Imported by: 0

README

平衡二叉树

LL, right rotation:
        x                   y
       /                   / \
      y        -->        z   x
     /
    z
RR, left rotation:
    x                       y
     \                     / \
      y        -->        x   z
       \
        z
LR, left right rotation:
        x                   x                     z
       /                   /                     / \
      y        -->        z         -->         y   x
       \                 /
        z               y
RL, right left rotation:
    x                   x                         z
     \                   \                       / \
      y        -->        z         -->         x   y
     /                     \
    z                       y

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Avl

type Avl struct {
	Root *TreeNode
}

Avl 平衡二叉树

func (*Avl) Insert

func (tree *Avl) Insert(value int)

Insert 插入

func (*Avl) Remove

func (tree *Avl) Remove(value int)

Remove 删除

func (*Avl) Search

func (tree *Avl) Search(value int) *TreeNode

Search 查找

type TreeNode

type TreeNode = binarytree.TreeNode

TreeNode 平衡二叉树结点

Jump to

Keyboard shortcuts

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