Java-冒泡排序
冒泡排序
public class BubbleSort { public static void main(String[] args) { int[] arr = { 11, 15, 14, 18, 22, 11, 50 }; int temp = 0; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr.length - i - 1; j++) { if (arr[j] > arr[j + 1]) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } } }
 
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号