Skip to content

Commit

Permalink
添加for循环的花括号以增加可读性和可维护性 (#1249)
Browse files Browse the repository at this point in the history
  • Loading branch information
echo1937 authored Apr 10, 2024
1 parent ab53647 commit 30fd4ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion codes/java/chapter_sorting/radix_sort.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 30fd4ef

Please sign in to comment.