private static int rank_recursive(int[] N, int key, int hi, int lo) {
		
		if (lo > hi) { 
			return KEY_NOT_FOUND; //base case
		}
		
		int mid = findMidpoint(hi, lo); // find the midpoint
		
		if (key < N[mid]) {  // the key is in the lower half so lower the upper bound 
			hi = --mid;
			rank_recursive(N, key, hi, lo);
		} else if (key > N[mid]) { // the key is in the upper half so raise the lower bound
			lo = ++mid;
			rank_recursive(N, key, hi, lo);
		} else {
			return mid;
		}		
		
		return KEY_NOT_FOUND;
	}