Add Python and C++ code for the counting sort. (#436)

This commit is contained in:
Yudong Jin
2023-03-21 22:24:17 +08:00
committed by GitHub
parent 6d452777a4
commit 65e47b0748
6 changed files with 163 additions and 19 deletions

View File

@ -68,11 +68,11 @@ public class counting_sort {
public static void main(String[] args) {
int[] nums = { 1, 0, 1, 2, 0, 4, 0, 2, 2, 4 };
countingSortNaive(nums);
System.out.println("计数排序(无法排序对象)完成后 nums = " + Arrays.toString(nums));
countingSort(nums);
System.out.println("计数排序完成后 nums = " + Arrays.toString(nums));
int[] nums1 = { 1, 0, 1, 2, 0, 4, 0, 2, 2, 4 };
countingSort(nums1);
System.out.println("计数排序完成后 nums1 = " + Arrays.toString(nums1));
}
}