java数据结构和算法------插入排序

 1 package iYou.neugle.sort;

 2 

 3 public class Insert_sort {

 4     public static void InsertSort(double[] array) {

 5         for (int i = 1; i < array.length; i++) {

 6             double currentNum = array[i];

 7             int j = i - 1;

 8             while (j >= 0 && array[j] > currentNum) {

 9                 array[j + 1] = array[j];

10                 j--;

11             }

12             array[j + 1] = currentNum;

13         }

14     }

15 }

 

你可能感兴趣的:(java)