Y
Hacker News
new
|
ask
|
show
|
jobs
by
mark-r
1565 days ago
Yes, it's always the midpoint calculation. Everybody forgets that (low+high) could overflow. It's trivial to work around once you know - just replace mid=(low+high)/2 with mid=low+(high-low)/2.