Function to perform binary search in an a subarray if elements of the subarray are in an ascending order
static int BS ( int X , int left , int right , ArrayList < Integer > arr ) { while ( left <= right ) {