This commit is contained in:
krahets
2024-04-11 01:11:20 +08:00
parent a6adc8e20a
commit 739f8a31bb
85 changed files with 1555 additions and 979 deletions

View File

@ -170,12 +170,13 @@ $$
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);
}
}
```