Here you can find the source of divideAndConquer(int[] array, int num)
public static int divideAndConquer(int[] array, int num)
//package com.java2s; //License from project: Open Source License public class Main { public static int divideAndConquer(int[] array, int num) { return divideAndConquer(array, num, 0, array.length - 1); }/*from w ww .j a va2 s.c o m*/ public static int divideAndConquer(int[] array, int num, int left, int right) { if (left > right) return -1; int middle = (right + left) / 2; if (array[middle] == num) return middle; if (array[middle] > num) return divideAndConquer(array, num, left, middle - 1); return divideAndConquer(array, num, middle + 1, right); } }