tree

package
v0.0.0-...-c234f5e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Value       int
	Left, Right *Node
}

Node 结构体定义 改成大写则表示 public

func CreateNode

func CreateNode(value int) *Node

CreateNode 虽然没有构造方法, 但是Go中可以写 工厂函数

func (Node) Print

func (node Node) Print()

Print 为结构体写方法 括号中的是 接收者, 表示 print() 是给 node 来接收的

func (*Node) SetValue

func (node *Node) SetValue(value int)

SetValue go语言中参数是传值的,因此需要加一个*, 传递指针 go语言的之间引用和间接引用都是. 不需要 ->

func (*Node) Traverse

func (node *Node) Traverse()

func (*Node) TraverseFunc

func (node *Node) TraverseFunc(f func(*Node))

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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