Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
func (*Node) MaxDepth ¶
非递归的方式求树的深度,广度优先遍历tree。
LeetCode的题,求树的最大深度:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/submissions/
func (Node) Print ¶
func (node Node) Print()
treeNode的方法-结构体接受者,函数名前面定义了一个接受者,表明该函数是结构体treeNode的一个方法,固俗称方法,下面定义的方法是值传递,无法改变接受者的内容
func (*Node) TraverseByChannel ¶
通过channel的方式,来遍历树(可以通过channel输出的遍历节点做自己的事),效果上来讲和TraverseFunc(回调函数的方式)遍历有异曲同工之妙
Click to show internal directories.
Click to hide internal directories.