diff --git a/codes/java/chapter_sorting/radix_sort.java b/codes/java/chapter_sorting/radix_sort.java index 6c08a7187a..25bc8d665a 100644 --- a/codes/java/chapter_sorting/radix_sort.java +++ b/codes/java/chapter_sorting/radix_sort.java @@ -50,12 +50,13 @@ static void radixSort(int[] nums) { if (num > m) m = num; // 按照从低位到高位的顺序遍历 - for (int exp = 1; exp <= m; exp *= 10) + for (int exp = 1; exp <= m; exp *= 10) { // 对数组元素的第 k 位执行计数排序 // k = 1 -> exp = 1 // k = 2 -> exp = 10 // 即 exp = 10^(k-1) countingSortDigit(nums, exp); + } } public static void main(String[] args) {