This commit is contained in:
krahets
2024-04-13 21:17:44 +08:00
parent 9332a91e26
commit 6afa70e7bc
55 changed files with 334 additions and 182 deletions

View File

@ -125,7 +125,7 @@ comments: true
```kotlin title=""
/* 二叉树的数组表示 */
// 使用 null 来表示空位
val tree = mutableListOf( 1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15 )
val tree = arrayOf( 1, 2, 3, 4, null, 6, 7, 8, 9, null, null, 12, null, null, 15 )
```
=== "Ruby"
@ -1172,7 +1172,7 @@ comments: true
=== "Kotlin"
```kotlin title="array_binary_tree.kt"
/* 构造方法 */
/* 数组表示下的二叉树类 */
class ArrayBinaryTree(val tree: MutableList<Int?>) {
/* 列表容量 */
fun size(): Int {