下面我们来看看二分查找的实现。其实我们通过二分查找的操作步骤,可以很轻易地想出二分查找使用递归实现也很方便。下面我们用递归来实现二分查找。public class BinarySearch { private int[] array; /** * 递归实现二分查找 * @param target * @return */ public int searchRecursion(int target) { if (array != null) { return searchRecursion(target, 0, array.length - 1); } return -1; } private int searchRecursion(int target, int start, int end) { if (start > end) { return -1; } int mid = start + (end - start) / 2; if (array[mid] == target) { return mid; } else if (target