Actually i got the point of adding 1 to the initial gap:-So that u can check for the next integral value.

But i still couldnt get the point behind decreasing the value of high to mid-1.(I mean why only to mid-1 and not to any other thing like we can reduce it to the next smaller value than hi,so why did we specifically choose to take it to mid-1).