摘要: 1 //Insertion Sort 2 3 for(int i = 1; i = 0 && a[j] > key; j--) 8 a[j + 1] = a[j]; 9 a[j + 1] = key; 10 } 阅读全文
posted @ 2019-03-09 20:51 Huayra 阅读(320) 评论(0) 推荐(0)
摘要: 1 public static int rank(int[] array, int k, int front, int rear) 2 { 3 if(front > rear) 4 return -1; 5 6 int mid = front + (rear - front) / 2; 7 if(k == array[m... 阅读全文
posted @ 2019-03-09 14:42 Huayra 阅读(205) 评论(0) 推荐(0)
摘要: 1 public static int rank(int[] array, int k) 2 { 3 int front = 0, rear = array.length - 1; 4 5 while(front array[mid]) front = mid + 1; 9 else if(k < array[mid]) rear = ... 阅读全文
posted @ 2019-03-09 14:35 Huayra 阅读(132) 评论(0) 推荐(0)