3 ms·
Not only can most programmers not create it, most can't implement it: Binary search is a great example because it's so simple and yet it's so easy to implement
by haihaibye 9y ago
Not only can most programmers not create it, most can't implement it:
Binary search is a great example because it's so simple and yet it's so easy to implement incorrectly. In Programming Pearly, Jon Bently shares how, over the years, he asked hundreds of programmers to implement binary search after providing them with a description of the basic algorithm. He gave them a very generous two hours to write it, and even allowed them to use the high-level language of their choice (including pseudocode). Surprisingly, only about 10 percent of professional programmers implemented binary search correctly. (Beautiful Code, p. 87)