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
Write a program to model an exploding firecracker in the xy plane using a particle system
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.
write a simple calculator c program to perform addition, subtraction, mul and div.
how to test pierrot divisor
Develop a routine to reflect an object about an arbitrarily selected plane
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql
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.
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
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
Design an implement of the inputs functions for event mode
How can you relate the function with the structure? Explain with an appropriate example.
How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?
Sir... please give some important coding questions asked by product companies..
could you please send the program code for multiplying sparse matrix in c????
What is full form of PEPSI