tree

package
v0.0.0-...-9b8d98b Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 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 RootedNode

type RootedNode struct {
	Parent int
	Left   int
	Right  int
}

RootedNode 左子右兄弟表示法结构

func (*RootedNode) Children

func (r *RootedNode) Children(tree []RootedNode) []RootedNode

Children return the children of the node.

func (*RootedNode) Depth

func (r *RootedNode) Depth(tree []RootedNode) int

Depth 求节点在树的深度

func (*RootedNode) DepthRec

func (r *RootedNode) DepthRec(tree []RootedNode) int

DepthRec 返回树的深度, 递归

func (*RootedNode) Print

func (r *RootedNode) Print(tree []RootedNode)

Print 输出树的信息

func (*RootedNode) Type

func (r *RootedNode) Type() string

Type return the kind of node in the tree.

func (*RootedNode) Value

func (r *RootedNode) Value(tree []RootedNode) int

Value return the node value in the tree.

Jump to

Keyboard shortcuts

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