From 42f48405ef115fb84bf9c348ccac8d2e14050d90 Mon Sep 17 00:00:00 2001 From: curtishd <131777542+curtishd@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:14:55 +0800 Subject: [PATCH] Fix all the incorrect comment in kotin files (#1176) * feat(kotlin): add kotlin code for utils file. * Update ListNode.kt * Update PrintUtil.kt * fix: add the header comment for linkedlist_stack class. * fix(kotlin): fix the kotlin file name. * delete blank line in main function * add comment for class head. * delete the old file. * fix the created time * delete blank line beneath files. --------- Co-authored-by: Yudong Jin --- codes/kotlin/chapter_array_and_linkedlist/linked_list.kt | 2 +- codes/kotlin/chapter_divide_and_conquer/hanota.kt | 2 +- .../{climbing_stiars_dfs_mem.kt => climbing_stairs_dfs_mem.kt} | 0 codes/kotlin/chapter_hashing/array_hash_map.kt | 1 - codes/kotlin/chapter_searching/binary_search.kt | 2 +- codes/kotlin/chapter_searching/binary_search_edge.kt | 2 +- codes/kotlin/chapter_searching/binary_search_insertion.kt | 2 +- codes/kotlin/chapter_searching/hashing_search.kt | 2 +- codes/kotlin/chapter_searching/linear_search.kt | 2 +- codes/kotlin/chapter_searching/two_sum.kt | 2 +- codes/kotlin/chapter_sorting/bubble_sort.kt | 2 +- codes/kotlin/chapter_sorting/bucket_sort.kt | 2 +- codes/kotlin/chapter_sorting/counting_sort.kt | 2 +- codes/kotlin/chapter_sorting/heap_sort.kt | 2 +- codes/kotlin/chapter_sorting/insertion_sort.kt | 2 +- codes/kotlin/chapter_sorting/merge_sort.kt | 2 +- codes/kotlin/chapter_sorting/quick_sort.kt | 2 +- codes/kotlin/chapter_sorting/radix_sort.kt | 2 +- codes/kotlin/chapter_sorting/selection_sort.kt | 2 +- codes/kotlin/chapter_stack_and_queue/linkedlist_queue.kt | 3 ++- codes/kotlin/chapter_stack_and_queue/linkedlist_stack.kt | 1 + 21 files changed, 20 insertions(+), 19 deletions(-) rename codes/kotlin/chapter_dynamic_programming/{climbing_stiars_dfs_mem.kt => climbing_stairs_dfs_mem.kt} (100%) diff --git a/codes/kotlin/chapter_array_and_linkedlist/linked_list.kt b/codes/kotlin/chapter_array_and_linkedlist/linked_list.kt index 7da8587cf..0f02569eb 100644 --- a/codes/kotlin/chapter_array_and_linkedlist/linked_list.kt +++ b/codes/kotlin/chapter_array_and_linkedlist/linked_list.kt @@ -77,4 +77,4 @@ fun main() { /* 查找节点 */ val index: Int = find(n0, 2) println("链表中值为 2 的节点的索引 = $index") -} +} \ No newline at end of file diff --git a/codes/kotlin/chapter_divide_and_conquer/hanota.kt b/codes/kotlin/chapter_divide_and_conquer/hanota.kt index 59c67f90e..4fff27fea 100644 --- a/codes/kotlin/chapter_divide_and_conquer/hanota.kt +++ b/codes/kotlin/chapter_divide_and_conquer/hanota.kt @@ -1,6 +1,6 @@ /** * File: hanota.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_dynamic_programming/climbing_stiars_dfs_mem.kt b/codes/kotlin/chapter_dynamic_programming/climbing_stairs_dfs_mem.kt similarity index 100% rename from codes/kotlin/chapter_dynamic_programming/climbing_stiars_dfs_mem.kt rename to codes/kotlin/chapter_dynamic_programming/climbing_stairs_dfs_mem.kt diff --git a/codes/kotlin/chapter_hashing/array_hash_map.kt b/codes/kotlin/chapter_hashing/array_hash_map.kt index 489667f2b..fcf0879f9 100644 --- a/codes/kotlin/chapter_hashing/array_hash_map.kt +++ b/codes/kotlin/chapter_hashing/array_hash_map.kt @@ -16,7 +16,6 @@ class Pair( class ArrayHashMap { private val buckets = arrayOfNulls(100) - /* 构造方法 */ init { // 初始化数组,包含 100 个桶 for (i in 0..<100) { diff --git a/codes/kotlin/chapter_searching/binary_search.kt b/codes/kotlin/chapter_searching/binary_search.kt index f706240a2..4eae98e68 100644 --- a/codes/kotlin/chapter_searching/binary_search.kt +++ b/codes/kotlin/chapter_searching/binary_search.kt @@ -1,6 +1,6 @@ /** * File: binary_search.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_searching/binary_search_edge.kt b/codes/kotlin/chapter_searching/binary_search_edge.kt index bf4d773cc..a51803b1d 100644 --- a/codes/kotlin/chapter_searching/binary_search_edge.kt +++ b/codes/kotlin/chapter_searching/binary_search_edge.kt @@ -1,6 +1,6 @@ /** * File: binary_search_edge.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_searching/binary_search_insertion.kt b/codes/kotlin/chapter_searching/binary_search_insertion.kt index 74091ce73..7c5279e6b 100644 --- a/codes/kotlin/chapter_searching/binary_search_insertion.kt +++ b/codes/kotlin/chapter_searching/binary_search_insertion.kt @@ -1,6 +1,6 @@ /** * File: binary_search_insertion.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_searching/hashing_search.kt b/codes/kotlin/chapter_searching/hashing_search.kt index fed41f179..cbc0d9fbb 100644 --- a/codes/kotlin/chapter_searching/hashing_search.kt +++ b/codes/kotlin/chapter_searching/hashing_search.kt @@ -1,6 +1,6 @@ /** * File: hashing_search.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_searching/linear_search.kt b/codes/kotlin/chapter_searching/linear_search.kt index 591468fd1..4cfd87fec 100644 --- a/codes/kotlin/chapter_searching/linear_search.kt +++ b/codes/kotlin/chapter_searching/linear_search.kt @@ -1,6 +1,6 @@ /** * File: linear_search.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_searching/two_sum.kt b/codes/kotlin/chapter_searching/two_sum.kt index 95b947c08..8e3e1e16d 100644 --- a/codes/kotlin/chapter_searching/two_sum.kt +++ b/codes/kotlin/chapter_searching/two_sum.kt @@ -1,6 +1,6 @@ /** * File: two_sum.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/bubble_sort.kt b/codes/kotlin/chapter_sorting/bubble_sort.kt index 427e28d69..4fb482550 100644 --- a/codes/kotlin/chapter_sorting/bubble_sort.kt +++ b/codes/kotlin/chapter_sorting/bubble_sort.kt @@ -1,6 +1,6 @@ /** * File: bubble_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/bucket_sort.kt b/codes/kotlin/chapter_sorting/bucket_sort.kt index 3e1bb8720..e4b1d9ff2 100644 --- a/codes/kotlin/chapter_sorting/bucket_sort.kt +++ b/codes/kotlin/chapter_sorting/bucket_sort.kt @@ -1,6 +1,6 @@ /** * File: bucket_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/counting_sort.kt b/codes/kotlin/chapter_sorting/counting_sort.kt index 12d44e1ff..13e9b6df9 100644 --- a/codes/kotlin/chapter_sorting/counting_sort.kt +++ b/codes/kotlin/chapter_sorting/counting_sort.kt @@ -1,6 +1,6 @@ /** * File: counting_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/heap_sort.kt b/codes/kotlin/chapter_sorting/heap_sort.kt index d169e3e65..9cb1f45d6 100644 --- a/codes/kotlin/chapter_sorting/heap_sort.kt +++ b/codes/kotlin/chapter_sorting/heap_sort.kt @@ -1,6 +1,6 @@ /** * File: heap_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/insertion_sort.kt b/codes/kotlin/chapter_sorting/insertion_sort.kt index a272927a5..c16947307 100644 --- a/codes/kotlin/chapter_sorting/insertion_sort.kt +++ b/codes/kotlin/chapter_sorting/insertion_sort.kt @@ -1,6 +1,6 @@ /** * File: insertion_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/merge_sort.kt b/codes/kotlin/chapter_sorting/merge_sort.kt index f9b77ae63..291ddde1f 100644 --- a/codes/kotlin/chapter_sorting/merge_sort.kt +++ b/codes/kotlin/chapter_sorting/merge_sort.kt @@ -1,6 +1,6 @@ /** * File: merge_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/quick_sort.kt b/codes/kotlin/chapter_sorting/quick_sort.kt index 82ab5c04e..09f8c91bb 100644 --- a/codes/kotlin/chapter_sorting/quick_sort.kt +++ b/codes/kotlin/chapter_sorting/quick_sort.kt @@ -1,6 +1,6 @@ /** * File: quick_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/radix_sort.kt b/codes/kotlin/chapter_sorting/radix_sort.kt index fa8ee8e84..16aa13c98 100644 --- a/codes/kotlin/chapter_sorting/radix_sort.kt +++ b/codes/kotlin/chapter_sorting/radix_sort.kt @@ -1,6 +1,6 @@ /** * File: radix_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_sorting/selection_sort.kt b/codes/kotlin/chapter_sorting/selection_sort.kt index 6293a4bc7..61eb173c3 100644 --- a/codes/kotlin/chapter_sorting/selection_sort.kt +++ b/codes/kotlin/chapter_sorting/selection_sort.kt @@ -1,6 +1,6 @@ /** * File: selection_sort.kt - * Created Time: 2024-1-25 + * Created Time: 2024-01-25 * Author: curtishd (1023632660@qq.com) */ diff --git a/codes/kotlin/chapter_stack_and_queue/linkedlist_queue.kt b/codes/kotlin/chapter_stack_and_queue/linkedlist_queue.kt index 5267b493a..33f48d560 100644 --- a/codes/kotlin/chapter_stack_and_queue/linkedlist_queue.kt +++ b/codes/kotlin/chapter_stack_and_queue/linkedlist_queue.kt @@ -6,6 +6,7 @@ package chapter_stack_and_queue +/* 基于链表实现的队列 */ class LinkedListQueue( // 头节点 front ,尾节点 rear private var front: ListNode? = null, @@ -94,4 +95,4 @@ fun main() { /* 判断队列是否为空 */ val isEmpty = queue.isEmpty() println("队列是否为空 = $isEmpty") -} \ No newline at end of file +} diff --git a/codes/kotlin/chapter_stack_and_queue/linkedlist_stack.kt b/codes/kotlin/chapter_stack_and_queue/linkedlist_stack.kt index eb138f4d5..f51b0b9eb 100644 --- a/codes/kotlin/chapter_stack_and_queue/linkedlist_stack.kt +++ b/codes/kotlin/chapter_stack_and_queue/linkedlist_stack.kt @@ -6,6 +6,7 @@ package chapter_stack_and_queue +/* 基于链表实现的栈 */ class LinkedListStack( private var stackPeek: ListNode? = null, // 将头节点作为栈顶 private var stkSize: Int = 0 // 栈的长度