bst

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bst

type Bst struct {
	Root *TreeNode
}

Bst 二叉搜索树

func (*Bst) Delete

func (tree *Bst) Delete(value int)

Delete 删除结点 被删除结点没有左结点,直接用右结点代替它 被删除结点没有右结点,用左结点代替它 被删除结点有左右结点,找到它的后继结点,把后继结点的值赋值给当前结点,删除右子树上的后继结点

func (*Bst) Insert

func (tree *Bst) Insert(value int)

Insert 插入新结点 插入操作只会插在叶子结点后

func (*Bst) Search

func (tree *Bst) 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