About the square root function

what does mid=(s+e)>>1 means in the code int the video?

@aslesha.j7 >> is the bitwise right shift operator. It results in dividing the number by 2. n >>2 means n/2. Bitwise operations are really fast, this is why it is being used instead of normal division.
So that line means mid = (s+e)/2

but they have used (s+e)>>1 not (s+e)>>2

Hi @aslesha.j7

Yes you are right, actually how right shift operator (>>) works is

x >> y => x / (2^y)

So, that’s why when you have written (s+e)>>1 it will result in (s+e)/(2^1) which is (s+e)/2

here ^ represents power, (x^y) is x raised to power y.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.