The number of distinct binary search trees (BSTs) that can be created from 4 distinct keys is 14. This result comes from the Catalan number formula, which counts the number of unique BSTs for nnn distinct keys:
Cn=1n+1(2nn)C_n=\frac{1}{n+1}\binom{2n}{n}Cn=n+11(n2n)
For n=4n=4n=4, this becomes:
C4=15(84)=15×70=14C_4=\frac{1}{5}\binom{8}{4}=\frac{1}{5}\times 70=14C4=51(48)=51×70=14
Thus, there are 14 structurally unique BSTs that can be formed with 4 distinct keys