Given n nodes. Find the number of different structural
binary trees that can be formed using the nodes.

Answer Posted / ajeet

int countTrees(int num)
{
if(num<=1)
return 1;
else
{
int root,left,right,sum=0;
for(root=1;root<=num;root++)
{
left=countTrees(root-1);
right=countTrees(num-root);
sum+=left*right;
}
return sum;
}
}

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to model an exploding firecracker in the xy plane using a particle system

3674


3) Int Matrix of certain size was given, We had few valu= es in it like this. =97=97=97=97=97=97=97=97=97=97=97 1 = | 4 | | 5 | &= nbsp; | 45 =97=97=97=97=97=97=97=97=97=97=97 &n= bsp; | 3 | 3 | 5 | = | 4 =97=97=97=97=97=97=97=97=97=97=97 34 |&nbs= p; 3 | 3 | | 12 | &= nbsp; =97=97=97=97=97=97=97=97=97=97=97 3 | &nbs= p; | 3 | 4 | = | 3 =97=97=97=97=97=97=97=97=97=97=97 3 | = ; | | | = ; 3 | =97=97=97=97=97=97=97=97=97=97=97 &= nbsp; | | 4 | = ; | 4 | 3 We w= ere supposed to move back all the spaces in it at the end. Note: = If implemented this prog using recursion, would get higher preference.

3306


write a simple calculator c program to perform addition, subtraction, mul and div.

3126


how to test pierrot divisor

2242


Develop a routine to reflect an object about an arbitrarily selected plane

2972






What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2389


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2126


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

6293


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

3832


Design an implement of the inputs functions for event mode

2946


How can you relate the function with the structure? Explain with an appropriate example.

2901


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2000


Sir... please give some important coding questions asked by product companies..

1781


could you please send the program code for multiplying sparse matrix in c????

3057


What is full form of PEPSI

1845