From 30fd4ef646f839e6bf66b3c0f570802d007b12ed Mon Sep 17 00:00:00 2001 From: echoless <15990013064@139.com> Date: Wed, 10 Apr 2024 19:01:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0for=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E7=9A=84=E8=8A=B1=E6=8B=AC=E5=8F=B7=E4=BB=A5=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8F=AF=E8=AF=BB=E6=80=A7=E5=92=8C=E5=8F=AF=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E6=80=A7=20(#1249)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codes/java/chapter_sorting/radix_sort.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codes/java/chapter_sorting/radix_sort.java b/codes/java/chapter_sorting/radix_sort.java index 6c08a7187..25bc8d665 100644 --- a/codes/java/chapter_sorting/radix_sort.java +++ b/codes/java/chapter_sorting/radix_sort.java @@ -50,12 +50,13 @@ public class radix_sort { 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) {