From 202450420d3264311fcbdb9fac21a0732e8c0d4c Mon Sep 17 00:00:00 2001 From: Yudong Jin Date: Mon, 25 Mar 2024 03:15:36 +0800 Subject: [PATCH] Add the kotlin blocks to the documents (#1170) --- docs/chapter_array_and_linkedlist/array.md | 6 ++++ .../linked_list.md | 18 ++++++++++ docs/chapter_array_and_linkedlist/list.md | 36 +++++++++++++++++++ .../backtracking_algorithm.md | 6 ++++ .../space_complexity.md | 18 ++++++++++ .../time_complexity.md | 24 +++++++++++++ .../basic_data_types.md | 6 ++++ docs/chapter_hashing/hash_algorithm.md | 6 ++++ docs/chapter_hashing/hash_map.md | 12 +++++++ docs/chapter_heap/heap.md | 6 ++++ docs/chapter_preface/suggestions.md | 13 +++++++ docs/chapter_stack_and_queue/deque.md | 6 ++++ docs/chapter_stack_and_queue/queue.md | 6 ++++ docs/chapter_stack_and_queue/stack.md | 6 ++++ .../array_representation_of_tree.md | 6 ++++ docs/chapter_tree/avl_tree.md | 6 ++++ docs/chapter_tree/binary_tree.md | 18 ++++++++++ 17 files changed, 199 insertions(+) diff --git a/docs/chapter_array_and_linkedlist/array.md b/docs/chapter_array_and_linkedlist/array.md index f0f68ee8a..0625316ff 100755 --- a/docs/chapter_array_and_linkedlist/array.md +++ b/docs/chapter_array_and_linkedlist/array.md @@ -105,6 +105,12 @@ int nums[5] = { 1, 3, 2, 5, 4 }; ``` +=== "Kotlin" + + ```kotlin title="array.kt" + + ``` + === "Zig" ```zig title="array.zig" diff --git a/docs/chapter_array_and_linkedlist/linked_list.md b/docs/chapter_array_and_linkedlist/linked_list.md index 24a7bbcec..3493a743c 100755 --- a/docs/chapter_array_and_linkedlist/linked_list.md +++ b/docs/chapter_array_and_linkedlist/linked_list.md @@ -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="" diff --git a/docs/chapter_array_and_linkedlist/list.md b/docs/chapter_array_and_linkedlist/list.md index 6502a0beb..b62df785c 100755 --- a/docs/chapter_array_and_linkedlist/list.md +++ b/docs/chapter_array_and_linkedlist/list.md @@ -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" diff --git a/docs/chapter_backtracking/backtracking_algorithm.md b/docs/chapter_backtracking/backtracking_algorithm.md index d1a89bc0d..f3a3da5a1 100644 --- a/docs/chapter_backtracking/backtracking_algorithm.md +++ b/docs/chapter_backtracking/backtracking_algorithm.md @@ -377,6 +377,12 @@ } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" diff --git a/docs/chapter_computational_complexity/space_complexity.md b/docs/chapter_computational_complexity/space_complexity.md index a6534fbe8..207881145 100755 --- a/docs/chapter_computational_complexity/space_complexity.md +++ b/docs/chapter_computational_complexity/space_complexity.md @@ -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="" diff --git a/docs/chapter_computational_complexity/time_complexity.md b/docs/chapter_computational_complexity/time_complexity.md index d8de152c7..63ddfddcf 100755 --- a/docs/chapter_computational_complexity/time_complexity.md +++ b/docs/chapter_computational_complexity/time_complexity.md @@ -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="" diff --git a/docs/chapter_data_structure/basic_data_types.md b/docs/chapter_data_structure/basic_data_types.md index a504b9d45..81b3b3b92 100644 --- a/docs/chapter_data_structure/basic_data_types.md +++ b/docs/chapter_data_structure/basic_data_types.md @@ -153,6 +153,12 @@ bool bools[10]; ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" diff --git a/docs/chapter_hashing/hash_algorithm.md b/docs/chapter_hashing/hash_algorithm.md index 8593a74ec..d753d72b4 100644 --- a/docs/chapter_hashing/hash_algorithm.md +++ b/docs/chapter_hashing/hash_algorithm.md @@ -343,6 +343,12 @@ $$ // C 未提供内置 hash code 函数 ``` +=== "Kotlin" + + ```kotlin title="built_in_hash.kt" + + ``` + === "Zig" ```zig title="built_in_hash.zig" diff --git a/docs/chapter_hashing/hash_map.md b/docs/chapter_hashing/hash_map.md index 5e8cdec0d..cba5c8b3e 100755 --- a/docs/chapter_hashing/hash_map.md +++ b/docs/chapter_hashing/hash_map.md @@ -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" diff --git a/docs/chapter_heap/heap.md b/docs/chapter_heap/heap.md index 5092430bc..a8bedef1b 100644 --- a/docs/chapter_heap/heap.md +++ b/docs/chapter_heap/heap.md @@ -365,6 +365,12 @@ // C 未提供内置 Heap 类 ``` +=== "Kotlin" + + ```kotlin title="heap.kt" + + ``` + === "Zig" ```zig title="heap.zig" diff --git a/docs/chapter_preface/suggestions.md b/docs/chapter_preface/suggestions.md index 6fde43e99..272094bc3 100644 --- a/docs/chapter_preface/suggestions.md +++ b/docs/chapter_preface/suggestions.md @@ -156,6 +156,19 @@ */ ``` +=== "Kotlin" + + ```kotlin title="" + /* 标题注释,用于标注函数、类、测试样例等 */ + + // 内容注释,用于详解代码 + + /** + * 多行 + * 注释 + */ + ``` + === "Zig" ```zig title="" diff --git a/docs/chapter_stack_and_queue/deque.md b/docs/chapter_stack_and_queue/deque.md index 1568c2872..34e46a124 100644 --- a/docs/chapter_stack_and_queue/deque.md +++ b/docs/chapter_stack_and_queue/deque.md @@ -324,6 +324,12 @@ // C 未提供内置双向队列 ``` +=== "Kotlin" + + ```kotlin title="deque.kt" + + ``` + === "Zig" ```zig title="deque.zig" diff --git a/docs/chapter_stack_and_queue/queue.md b/docs/chapter_stack_and_queue/queue.md index 27d482620..2a4413e65 100755 --- a/docs/chapter_stack_and_queue/queue.md +++ b/docs/chapter_stack_and_queue/queue.md @@ -302,6 +302,12 @@ // C 未提供内置队列 ``` +=== "Kotlin" + + ```kotlin title="queue.kt" + + ``` + === "Zig" ```zig title="queue.zig" diff --git a/docs/chapter_stack_and_queue/stack.md b/docs/chapter_stack_and_queue/stack.md index a8fe86b98..1a50b1fda 100755 --- a/docs/chapter_stack_and_queue/stack.md +++ b/docs/chapter_stack_and_queue/stack.md @@ -296,6 +296,12 @@ // C 未提供内置栈 ``` +=== "Kotlin" + + ```kotlin title="stack.kt" + + ``` + === "Zig" ```zig title="stack.zig" diff --git a/docs/chapter_tree/array_representation_of_tree.md b/docs/chapter_tree/array_representation_of_tree.md index 1de9d4e26..d796967b2 100644 --- a/docs/chapter_tree/array_representation_of_tree.md +++ b/docs/chapter_tree/array_representation_of_tree.md @@ -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="" diff --git a/docs/chapter_tree/avl_tree.md b/docs/chapter_tree/avl_tree.md index 69f94b05b..8d03fdd06 100644 --- a/docs/chapter_tree/avl_tree.md +++ b/docs/chapter_tree/avl_tree.md @@ -200,6 +200,12 @@ AVL 树既是二叉搜索树,也是平衡二叉树,同时满足这两类二 } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" diff --git a/docs/chapter_tree/binary_tree.md b/docs/chapter_tree/binary_tree.md index 9ff5dcab1..44bc8c872 100644 --- a/docs/chapter_tree/binary_tree.md +++ b/docs/chapter_tree/binary_tree.md @@ -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"