binary search base case

if(low==high)
{
if(a[low]==key)
{
return low;
}
else
{cout<<“THE value doesnt exist”;
return nill;
}

why is this base case not working for binary search

it might be a case that in while loop , the low index has passed (become greater) ,than ‘high’ index , therefore , i guess your if condition is not getting satisfied and hence , not giving desired output.

can u please provide a simple test case ?? i mean what u are saying is the standard recursive definition but i am just curious to know why this case isnt working

can u give ur whole code…or maybe the whole of ur binary search implementation!!!

//