mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-31 22:33:10 +08:00
build
This commit is contained in:
@ -305,7 +305,7 @@ Breadth-first traversal is usually implemented with the help of a "queue". The q
|
||||
val list = mutableListOf<Int>()
|
||||
while (queue.isNotEmpty()) {
|
||||
val node = queue.poll() // 队列出队
|
||||
list.add(node?._val!!) // 保存节点值
|
||||
list.add(node?._val!!) // 保存节点值
|
||||
if (node.left != null)
|
||||
queue.offer(node.left) // 左子节点入队
|
||||
if (node.right != null)
|
||||
|
Reference in New Issue
Block a user