This has been bothering me for a while. I know that given N keys to arrange in the form of a binary search tree, the possible number of trees that can be created correspond
Well here is the recursive solution to count the trees...
int countTrees(int numkeys){
if(numkeys > 1){
int i =1;
int sum=0;
for(i = 1; i <= numkeys; i++){
int lcount = countTrees(i-1);
int rcount = countTrees(numkeys-i);
sum += lcount*rcount;
}
return(sum);
}else
return(1);
}