Fix a comment in binary_tree_bfs.go

This commit is contained in:
krahets 2023-03-13 22:47:22 +08:00
parent 516cb17775
commit b37a088f7d

View file

@ -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)