public int countTrees(int n){
        int T[] = new int[n+1];
        T[0] = 1;
        T[1] = 1;
        for(int i=2; i <= n; i++){
            for(int j=0; j <i; j++){
                T[i] += T[j]*T[i-j-1];
            }
        }
        return T[n];
    }
http://www.geeksforgeeks.org/program-nth-catalan-number/
Count number of binary search tree created for array of size n
src/com/interview/dynamic/CountNumberOfTreesInBST.java