mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 02:16:29 +08:00
Fix a comment in binary_tree_bfs.go
This commit is contained in:
parent
516cb17775
commit
b37a088f7d
1 changed files with 1 additions and 1 deletions
|
@ -18,7 +18,7 @@ func levelOrder(root *TreeNode) []int {
|
||||||
// 初始化一个切片,用于保存遍历序列
|
// 初始化一个切片,用于保存遍历序列
|
||||||
nums := make([]int, 0)
|
nums := make([]int, 0)
|
||||||
for queue.Len() > 0 {
|
for queue.Len() > 0 {
|
||||||
// 队首元素出队
|
// 队列出队
|
||||||
node := queue.Remove(queue.Front()).(*TreeNode)
|
node := queue.Remove(queue.Front()).(*TreeNode)
|
||||||
// 保存结点值
|
// 保存结点值
|
||||||
nums = append(nums, node.Val)
|
nums = append(nums, node.Val)
|
||||||
|
|
Loading…
Reference in a new issue