mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-04 06:07:20 +08:00 
			
		
		
		
	添加for循环的花括号以增加可读性和可维护性 (#1249)
This commit is contained in:
		@ -50,13 +50,14 @@ public class radix_sort {
 | 
				
			|||||||
            if (num > m)
 | 
					            if (num > m)
 | 
				
			||||||
                m = num;
 | 
					                m = num;
 | 
				
			||||||
        // 按照从低位到高位的顺序遍历
 | 
					        // 按照从低位到高位的顺序遍历
 | 
				
			||||||
        for (int exp = 1; exp <= m; exp *= 10)
 | 
					        for (int exp = 1; exp <= m; exp *= 10) {
 | 
				
			||||||
            // 对数组元素的第 k 位执行计数排序
 | 
					            // 对数组元素的第 k 位执行计数排序
 | 
				
			||||||
            // k = 1 -> exp = 1
 | 
					            // k = 1 -> exp = 1
 | 
				
			||||||
            // k = 2 -> exp = 10
 | 
					            // k = 2 -> exp = 10
 | 
				
			||||||
            // 即 exp = 10^(k-1)
 | 
					            // 即 exp = 10^(k-1)
 | 
				
			||||||
            countingSortDigit(nums, exp);
 | 
					            countingSortDigit(nums, exp);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void main(String[] args) {
 | 
					    public static void main(String[] args) {
 | 
				
			||||||
        // 基数排序
 | 
					        // 基数排序
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user