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?

--

--

--

Always learning.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Saul Feliz

Saul Feliz

Always learning.

More from Medium

Being Grateful and Saying ‘Thank You’ in Islam

An analysis of each team’s total titles (Super Bowl wins and pre-1966 championships) vs expected…

algorithms and data structures every coder must know:

3+ Years Later and Millions of U.S.