binarysearchtree

package
v0.0.0-...-b5285df Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package binarysearchtree 非平衡二分搜索树

From https://flaviocopes.com/golang-data-structure-binary-search-tree/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinarySearchTree

type BinarySearchTree struct {
	// contains filtered or unexported fields
}

BinarySearchTree 二分搜索树

func (*BinarySearchTree) InOrderTraverse

func (bst *BinarySearchTree) InOrderTraverse(f func(interface{}))

InOrderTraverse 遍历 -- 左中右

func (*BinarySearchTree) Insert

func (bst *BinarySearchTree) Insert(key string, value interface{})

Insert 添加元素

func (*BinarySearchTree) Max

func (bst *BinarySearchTree) Max() interface{}

Max 最大值

func (*BinarySearchTree) Min

func (bst *BinarySearchTree) Min() interface{}

Min 最小值

func (*BinarySearchTree) PostOrderTraverse

func (bst *BinarySearchTree) PostOrderTraverse(f func(interface{}))

PostOrderTraverse 遍历 -- 左右中

func (*BinarySearchTree) PreOrderTraverse

func (bst *BinarySearchTree) PreOrderTraverse(f func(interface{}))

PreOrderTraverse 遍历 -- 中左右

func (*BinarySearchTree) Remove

func (bst *BinarySearchTree) Remove(key string)

Remove 删除

func (*BinarySearchTree) Search

func (bst *BinarySearchTree) Search(key string) bool

Search 搜索

func (*BinarySearchTree) String

func (bst *BinarySearchTree) String()

String 输出字符串 -- 从左往右,从上往下

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node 节点

Jump to

Keyboard shortcuts

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