From 6b02449f2275b5be5df66379b17f29f99c32db68 Mon Sep 17 00:00:00 2001 From: Yudong Jin Date: Mon, 2 Jan 2023 19:09:46 +0800 Subject: [PATCH] Update the chapter sorting (Go code). --- codes/go/chapter_sorting/{bubble_sort => }/bubble_sort.go | 2 +- codes/go/chapter_sorting/{bubble_sort => }/bubble_sort_test.go | 2 +- .../go/chapter_sorting/{insertion_sort => }/insertion_sort.go | 2 +- .../{insertion_sort => }/insertion_sort_test.go | 2 +- codes/go/chapter_sorting/{merge_sort => }/merge_sort.go | 2 +- codes/go/chapter_sorting/{merge_sort => }/merge_sort_test.go | 3 ++- codes/go/chapter_sorting/{quick_sort => }/quick_sort.go | 2 +- codes/go/chapter_sorting/{quick_sort => }/quick_sort_test.go | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) rename codes/go/chapter_sorting/{bubble_sort => }/bubble_sort.go (97%) rename codes/go/chapter_sorting/{bubble_sort => }/bubble_sort_test.go (94%) rename codes/go/chapter_sorting/{insertion_sort => }/insertion_sort.go (95%) rename codes/go/chapter_sorting/{insertion_sort => }/insertion_sort_test.go (92%) rename codes/go/chapter_sorting/{merge_sort => }/merge_sort.go (98%) rename codes/go/chapter_sorting/{merge_sort => }/merge_sort_test.go (92%) rename codes/go/chapter_sorting/{quick_sort => }/quick_sort.go (99%) rename codes/go/chapter_sorting/{quick_sort => }/quick_sort_test.go (97%) diff --git a/codes/go/chapter_sorting/bubble_sort/bubble_sort.go b/codes/go/chapter_sorting/bubble_sort.go similarity index 97% rename from codes/go/chapter_sorting/bubble_sort/bubble_sort.go rename to codes/go/chapter_sorting/bubble_sort.go index a51d19925..ff1ff9ee5 100644 --- a/codes/go/chapter_sorting/bubble_sort/bubble_sort.go +++ b/codes/go/chapter_sorting/bubble_sort.go @@ -2,7 +2,7 @@ // Created Time: 2022-12-06 // Author: Slone123c (274325721@qq.com) -package bubble_sort +package chapter_sorting /* 冒泡排序 */ func bubbleSort(nums []int) { diff --git a/codes/go/chapter_sorting/bubble_sort/bubble_sort_test.go b/codes/go/chapter_sorting/bubble_sort_test.go similarity index 94% rename from codes/go/chapter_sorting/bubble_sort/bubble_sort_test.go rename to codes/go/chapter_sorting/bubble_sort_test.go index bab85139e..53a7d055a 100644 --- a/codes/go/chapter_sorting/bubble_sort/bubble_sort_test.go +++ b/codes/go/chapter_sorting/bubble_sort_test.go @@ -2,7 +2,7 @@ // Created Time: 2022-12-06 // Author: Slone123c (274325721@qq.com) -package bubble_sort +package chapter_sorting import ( "fmt" diff --git a/codes/go/chapter_sorting/insertion_sort/insertion_sort.go b/codes/go/chapter_sorting/insertion_sort.go similarity index 95% rename from codes/go/chapter_sorting/insertion_sort/insertion_sort.go rename to codes/go/chapter_sorting/insertion_sort.go index 2be78bcf6..24101e969 100644 --- a/codes/go/chapter_sorting/insertion_sort/insertion_sort.go +++ b/codes/go/chapter_sorting/insertion_sort.go @@ -2,7 +2,7 @@ // Created Time: 2022-12-12 // Author: msk397 (machangxinq@gmail.com) -package insertion_sort +package chapter_sorting func insertionSort(nums []int) { // 外循环:待排序元素数量为 n-1, n-2, ..., 1 diff --git a/codes/go/chapter_sorting/insertion_sort/insertion_sort_test.go b/codes/go/chapter_sorting/insertion_sort_test.go similarity index 92% rename from codes/go/chapter_sorting/insertion_sort/insertion_sort_test.go rename to codes/go/chapter_sorting/insertion_sort_test.go index 07a96b8f4..9802b406b 100644 --- a/codes/go/chapter_sorting/insertion_sort/insertion_sort_test.go +++ b/codes/go/chapter_sorting/insertion_sort_test.go @@ -2,7 +2,7 @@ // Created Time: 2022-12-12 // Author: msk397 (machangxinq@gmail.com) -package insertion_sort +package chapter_sorting import ( "fmt" diff --git a/codes/go/chapter_sorting/merge_sort/merge_sort.go b/codes/go/chapter_sorting/merge_sort.go similarity index 98% rename from codes/go/chapter_sorting/merge_sort/merge_sort.go rename to codes/go/chapter_sorting/merge_sort.go index f2910600a..1b3a3932d 100644 --- a/codes/go/chapter_sorting/merge_sort/merge_sort.go +++ b/codes/go/chapter_sorting/merge_sort.go @@ -2,7 +2,7 @@ // Created Time: 2022-12-13 // Author: msk397 (machangxinq@gmail.com) -package merge_sort +package chapter_sorting // 合并左子数组和右子数组 // 左子数组区间 [left, mid] diff --git a/codes/go/chapter_sorting/merge_sort/merge_sort_test.go b/codes/go/chapter_sorting/merge_sort_test.go similarity index 92% rename from codes/go/chapter_sorting/merge_sort/merge_sort_test.go rename to codes/go/chapter_sorting/merge_sort_test.go index 04abd443b..3ece175a1 100644 --- a/codes/go/chapter_sorting/merge_sort/merge_sort_test.go +++ b/codes/go/chapter_sorting/merge_sort_test.go @@ -1,8 +1,9 @@ -package merge_sort // File: merge_sort_test.go // Created Time: 2022-12-13 // Author: msk397 (machangxinq@gmail.com) +package chapter_sorting + import ( "fmt" "testing" diff --git a/codes/go/chapter_sorting/quick_sort/quick_sort.go b/codes/go/chapter_sorting/quick_sort.go similarity index 99% rename from codes/go/chapter_sorting/quick_sort/quick_sort.go rename to codes/go/chapter_sorting/quick_sort.go index d42eb0abd..88aa14264 100644 --- a/codes/go/chapter_sorting/quick_sort/quick_sort.go +++ b/codes/go/chapter_sorting/quick_sort.go @@ -2,7 +2,7 @@ // Created Time: 2022-12-12 // Author: msk397 (machangxinq@gmail.com) -package quick_sort +package chapter_sorting // 快速排序 type QuickSort struct{} diff --git a/codes/go/chapter_sorting/quick_sort/quick_sort_test.go b/codes/go/chapter_sorting/quick_sort_test.go similarity index 97% rename from codes/go/chapter_sorting/quick_sort/quick_sort_test.go rename to codes/go/chapter_sorting/quick_sort_test.go index 0a0a6d44a..86ae0115a 100644 --- a/codes/go/chapter_sorting/quick_sort/quick_sort_test.go +++ b/codes/go/chapter_sorting/quick_sort_test.go @@ -2,7 +2,7 @@ // Created Time: 2022-12-12 // Author: msk397 (machangxinq@gmail.com) -package quick_sort +package chapter_sorting import ( "fmt"