Saul Feliz
Feb 7, 2021

--

Hi John!

Thanks for the note. I think you just confusion on what's getting evaluated.

Let's say we have arr = [10, 35, 40, 50, 99]. And let's say we have mid = 3.

arr[mid - 1] is the same as arr[2], which in this case is 40.

But arr[mid] - 1 would be 50 - 1, which is 49.

The operations are happening in order. Thus, the comparison evaluator of higher/lower than isn't evaluating the same number at arr[mid - 1] as it is with arr[mid]-1.

Does that make sense?

--

--