前序
type treenode struct {
Val int
Left *treenode
Right *treenode
}
func (this *treenode) preOrder() {
if this == nil {
return
}
fmt.Println(this.Val)
this.Left.preOrder()
this.Right.preOrder()
}
中序
func (this *treenode) inOrder() {
if this == nil {
return
}
this.Left.inOrder()
fmt.Println(this.Val)
this.Right.inOrder()
}
后序
func (this *treenode) TreeNode() {
if this == nil {
return
}
this.Left.TreeNode()
this.Right.TreeNode()
fmt.Println(this.Val)
}

被折叠的 条评论
为什么被折叠?



