Binary Search(Java)(递归)


 public static int rank(int[] array, int k, int front, int rear)
{
if(front > rear)
return -1; int mid = front + (rear - front) / 2;
if(k == array[mid])
return mid;
else if(k > array[mid])
return rank(array, k, mid + 1, rear);
else
return rank(array, k, front, mid - 1);
}

 
上一篇:ADO.NET系列之操作XML


下一篇:jquery serialize()方法的扩展