What are the pitfalls in implementing binary search? [closed]

This question was just asked again recently. Apart from Knuth’s quote that “Although the basic idea of binary search is comparatively straightforward, the details can be surprisingly tricky”, there is the staggering historical fact (see TAOCP, Volume 3, section 6.2.1) that binary search was first published in 1946 but the first published binary search without … Read more

The possible number of binary search trees that can be created with N keys is given by the Nth catalan number. Why?

Since there are four proofs in the wikipedia article you referenced, it seems you aren’t looking for a mathematical explanation for the correspondence between the Catalan numbers and the permutations of a binary tree. So instead, here are two ways to try and intuitively visualise how the Catalan sequence (1, 2, 5, 14, 42, …) … Read more