This blog site is dedicated for articles on problem solving using C, C++, data structures, algorithms. Besides this few technical articles are also presented.
Apr 20, 2011
count unique binary trees those can be formed from n numbers
counttrees(n)
if(n <= 1)
return 1
sum = 0
for i 1 to n
{
l = counttrees(i-1)
r = counttrees(n-i)
sum += l + r
}
return sum
No comments:
Post a Comment