Nearly all binary search and merge sort implementations are broken (2006)
googleresearch.blogspot.com
Nearly all binary search and merge sort implementations are broken (2006)
1–10 of 70 posts
Re: Nearly all binary search and merge sort implementations are broken (2006)
#2Re: Nearly all binary search and merge sort implementations are broken (2006)
#3Re: Nearly all binary search and merge sort implementations are broken (2006)
#4Re: Nearly all binary search and merge sort implementations are broken (2006)
#5http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10...
The claim is that even ignoring overflow, only 10% of programmers can correctly implement a binary search. When I tried it, I thought I got it working, but it was later pointed out that I didn't handle empty lists correctly.
Programming correctly is hard.
Re: Nearly all binary search and merge sort implementations are broken (2006)
#6I once ran a programming challenge based on this, but I discontinued when I started to get threats of physical violence from people whose code didn't pass the tests.
The Dictionary of Algorithms and Data Structures on the NIST site has a correction I submitted on exactly this point:
http://xlinux.nist.gov/dads/HTML/binarySearch.html
And my blog post: http://www.solipsys.co.uk/new/BinarySearchReconsidered.html?...
Re: Nearly all binary search and merge sort implementations are broken (2006)
#7http://webcache.googleusercontent.com/search?strip=1&q=c...
IIRC, this made the rounds a few years ago, in case it sounds familiar.
Re: Nearly all binary search and merge sort implementations are broken (2006)
#8This statement is tantamount to saying "you don't merely need to prove Fermat's Last Theorem, you also have to test it for all possible input values". By this line of reasoning, most of mathematics should be thrown out.
If you've proven a program correct, it is correct for all input values, whether you have tested them or not. If your proof ignores complexities such as the range of data values, it isn't a correct proof to begin with. And yes, proving programs correct is often possible -- in fact, the highest levels of software verification actually require explicit proofs of correctness for much of the code; see http://en.wikipedia.org/wiki/Evaluation_Assurance_Level#EAL7...
Re: Nearly all binary search and merge sort implementations are broken (2006)
#9Re: Nearly all binary search and merge sort implementations are broken (2006)
#10It is not sufficient merely to prove a program correct; you have to test it too. Moreover, to be really certain that a program is correct, you have to test it for all possible input values, but this is seldom feasible. This statement is tantamount to saying "you don't merely need to prove Fermat's Last Theorem, you also have to test it for all possible input values". By this line of reasoning, most of mathematics sho…