package
Version:
v0.0.0-...-c234f5e
Opens a new window with list of versions in this module.
Published: Mar 9, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Node struct {
Value int
Left, Right *Node
}
Node 结构体定义
改成大写则表示 public
CreateNode 虽然没有构造方法, 但是Go中可以写 工厂函数
Print 为结构体写方法
括号中的是 接收者, 表示 print() 是给 node 来接收的
func (node *Node) SetValue(value int)
SetValue go语言中参数是传值的,因此需要加一个*, 传递指针
go语言的之间引用和间接引用都是. 不需要 ->
func (node *Node) Traverse()
func (node *Node) TraverseFunc(f func(*Node))
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.