Typo in the book page 9 Binary Search Code
loki-one opened this issue · comments
In the book on page 9 there is binary search code written in python.
In the while loop you have assigned mid = (low + high) instead of mid = (low + high) / 2.
This is not a major issue but in your future copies if you correct it then it would be great.
I hope this is useful.
The book is amazing and easy to grasp I am enjoying it.
The issue can also be solved by changing
if guess > item:
high = mid - 1
else:
low = mid + 1
into
if guess > item:
high = item - 1
else:
low = item + 1
to
In the book on page 9 there is binary search code written in python.
In the while loop you have assigned mid = (low + high) instead of mid = (low + high) / 2.
This issue is fixed in the author's errata.
Please close the issue as irrelevant.