public static boolean isBST(int[] array, int begin, int end) {
		int left = begin;
		int right = end - 1;
		if(end - begin <= 1)
			return true;
		while (left < end && array[end] > array[left])
			left++;
		while (right > begin && array[end] < array[right])
			right--;
		if(left - 1 == right || left == right)
			return isBST(array, begin, left - 1) && isBST(array, left, end - 1);
		else
			return false;
	}