Re:Nearly All Binary Searches and Mergesorts are Broken (2006)
by dtdt on Thursday July 09, 2015 @03:41PM
(#9860228)
The latter two suggested fixes are also incorrect for arrays of length > INT_MAX where the goal element is close to the end, there won't be any out of bounds array access though.
For example, when low is 0x70000002, high is 0x90000000
Re:Nearly All Binary Searches and Mergesorts are Broken (2006)
by hofstee on Thursday July 09, 2015 @07:36PM
(#9861418)
The article assumes the use of a signed integer, by passing in values that can't be represented with a signed integer you can't assume the same solutions hold.
For example, when low is 0x70000002, high is 0x90000000
and will both have mid as 1 due to unsigned int overflow.