|
|
@ -10,11 +10,10 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func TestCountingSort(t *testing.T) {
|
|
|
|
func TestCountingSort(t *testing.T) {
|
|
|
|
c := &CountingSort{}
|
|
|
|
|
|
|
|
nums := []int{1, 0, 1, 2, 0, 4, 0, 2, 2, 4}
|
|
|
|
nums := []int{1, 0, 1, 2, 0, 4, 0, 2, 2, 4}
|
|
|
|
c.countingSortNaive(nums)
|
|
|
|
countingSortNaive(nums)
|
|
|
|
fmt.Println("计数排序(无法排序对象)完成后 nums = ", nums)
|
|
|
|
fmt.Println("计数排序(无法排序对象)完成后 nums = ", nums)
|
|
|
|
|
|
|
|
|
|
|
|
c.countingSort(nums)
|
|
|
|
countingSort(nums)
|
|
|
|
fmt.Println("计数排序完成后 nums = ", nums)
|
|
|
|
fmt.Println("计数排序完成后 nums = ", nums)
|
|
|
|
}
|
|
|
|
}
|