How many binary search trees can be constructed from n distinct elements? And how can we find a mathematically proved formula for it?
Example:
Let T(n) be the number of bsts of n elements.
Given n distinct ordered elements, numbered 1 to n, we select i as the root.
This leaves (1..i-1) in the left subtree for T(i-1) combinations and (i+1..n) in the right subtree for T(n-i) combinations.
Therefore:
T(n) = sum_i=1^n(T(i-1) * T(n-i))
and of course T(1) = 1