mirror of
https://github.com/krahets/hello-algo.git
synced 2026-09-23 14:56:39 +08:00
Prepare 1.1.0 release (#1274)
* Update bucket_sort.c * Fix the comments in quick_sort.c * Update the announce badge * Sync zh and zh-hant versions * Update contributors list. * Sync zh and zh-hant versions. * Sync zh and zh-hant versions. * Update the contributors list * Update the version number
This commit is contained in:
@@ -19,7 +19,7 @@ fun levelOrder(root: TreeNode?): MutableList<Int> {
|
||||
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)
|
||||
@@ -31,7 +31,7 @@ fun levelOrder(root: TreeNode?): MutableList<Int> {
|
||||
/* Driver Code */
|
||||
fun main() {
|
||||
/* 初始化二元樹 */
|
||||
// 這裡藉助了一個從陣列直接生成二元樹的函式
|
||||
// 這裡藉助了一個從串列直接生成二元樹的函式
|
||||
val root = TreeNode.listToTree(mutableListOf(1, 2, 3, 4, 5, 6, 7))
|
||||
println("\n初始化二元樹\n")
|
||||
printTree(root)
|
||||
|
||||
Reference in New Issue
Block a user