Add the kotlin blocks to the documents (#1170)

This commit is contained in:
Yudong Jin 2024-03-25 03:15:36 +08:00 committed by GitHub
parent 55db99ab18
commit 202450420d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 199 additions and 0 deletions

View file

@ -105,6 +105,12 @@
int nums[5] = { 1, 3, 2, 5, 4 };
```
=== "Kotlin"
```kotlin title="array.kt"
```
=== "Zig"
```zig title="array.zig"

View file

@ -159,6 +159,12 @@
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""
@ -373,6 +379,12 @@
n3->next = n4;
```
=== "Kotlin"
```kotlin title="linked_list.kt"
```
=== "Zig"
```zig title="linked_list.zig"
@ -628,6 +640,12 @@
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""

View file

@ -126,6 +126,12 @@
// C 未提供内置动态数组
```
=== "Kotlin"
```kotlin title="list.kt"
```
=== "Zig"
```zig title="list.zig"
@ -248,6 +254,12 @@
// C 未提供内置动态数组
```
=== "Kotlin"
```kotlin title="list.kt"
```
=== "Zig"
```zig title="list.zig"
@ -472,6 +484,12 @@
// C 未提供内置动态数组
```
=== "Kotlin"
```kotlin title="list.kt"
```
=== "Zig"
```zig title="list.zig"
@ -662,6 +680,12 @@
// C 未提供内置动态数组
```
=== "Kotlin"
```kotlin title="list.kt"
```
=== "Zig"
```zig title="list.zig"
@ -774,6 +798,12 @@
// C 未提供内置动态数组
```
=== "Kotlin"
```kotlin title="list.kt"
```
=== "Zig"
```zig title="list.zig"
@ -868,6 +898,12 @@
// C 未提供内置动态数组
```
=== "Kotlin"
```kotlin title="list.kt"
```
=== "Zig"
```zig title="list.zig"

View file

@ -377,6 +377,12 @@
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""

View file

@ -309,6 +309,12 @@
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""
@ -455,6 +461,12 @@
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""
@ -693,6 +705,12 @@
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""

View file

@ -171,6 +171,12 @@
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""
@ -429,6 +435,12 @@ $$
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""
@ -623,6 +635,12 @@ $$
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""
@ -880,6 +898,12 @@ $T(n)$ 是一次函数,说明其运行时间的增长趋势是线性的,因
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""

View file

@ -153,6 +153,12 @@
bool bools[10];
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""

View file

@ -343,6 +343,12 @@ $$
// C 未提供内置 hash code 函数
```
=== "Kotlin"
```kotlin title="built_in_hash.kt"
```
=== "Zig"
```zig title="built_in_hash.zig"

View file

@ -267,6 +267,12 @@
// C 未提供内置哈希表
```
=== "Kotlin"
```kotlin title="hash_map.kt"
```
=== "Zig"
```zig title="hash_map.zig"
@ -462,6 +468,12 @@
// C 未提供内置哈希表
```
=== "Kotlin"
```kotlin title="hash_map.kt"
```
=== "Zig"
```zig title="hash_map.zig"

View file

@ -365,6 +365,12 @@
// C 未提供内置 Heap 类
```
=== "Kotlin"
```kotlin title="heap.kt"
```
=== "Zig"
```zig title="heap.zig"

View file

@ -156,6 +156,19 @@
*/
```
=== "Kotlin"
```kotlin title=""
/* 标题注释,用于标注函数、类、测试样例等 */
// 内容注释,用于详解代码
/**
* 多行
* 注释
*/
```
=== "Zig"
```zig title=""

View file

@ -324,6 +324,12 @@
// C 未提供内置双向队列
```
=== "Kotlin"
```kotlin title="deque.kt"
```
=== "Zig"
```zig title="deque.zig"

View file

@ -302,6 +302,12 @@
// C 未提供内置队列
```
=== "Kotlin"
```kotlin title="queue.kt"
```
=== "Zig"
```zig title="queue.zig"

View file

@ -296,6 +296,12 @@
// C 未提供内置栈
```
=== "Kotlin"
```kotlin title="stack.kt"
```
=== "Zig"
```zig title="stack.zig"

View file

@ -112,6 +112,12 @@
int tree[] = {1, 2, 3, 4, INT_MAX, 6, 7, 8, 9, INT_MAX, INT_MAX, 12, INT_MAX, INT_MAX, 15};
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""

View file

@ -200,6 +200,12 @@ AVL 树既是二叉搜索树,也是平衡二叉树,同时满足这两类二
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""

View file

@ -176,6 +176,12 @@
}
```
=== "Kotlin"
```kotlin title=""
```
=== "Zig"
```zig title=""
@ -397,6 +403,12 @@
n2->right = n5;
```
=== "Kotlin"
```kotlin title="binary_tree.kt"
```
=== "Zig"
```zig title="binary_tree.zig"
@ -542,6 +554,12 @@
n1->left = n2;
```
=== "Kotlin"
```kotlin title="binary_tree.kt"
```
=== "Zig"
```zig title="binary_tree.zig"