tree

package
v0.0.0-...-b071cee Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	// contains filtered or unexported methods
}

type Measurer

type Measurer interface {
	// contains filtered or unexported methods
}

type TreeNode

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

func BuildTree

func BuildTree(preorder []int, inorder []int) *TreeNode

BuildTree 根据前序遍历序列和中序遍历序列构造一个树,遍历序列中不可含有重复值

func (*TreeNode) Find

func (root *TreeNode) Find(v int) *TreeNode

func (*TreeNode) InOrder

func (root *TreeNode) InOrder(Visit func(node *TreeNode))

func (*TreeNode) PostOrder

func (root *TreeNode) PostOrder(Visit func(node *TreeNode))

func (*TreeNode) PreOrder

func (root *TreeNode) PreOrder(Visit func(node *TreeNode))

Jump to

Keyboard shortcuts

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