is n not the number of nodes?
On Fri, Jul 30, 2010 at 11:58 AM, Pramod Negi wrote:
> Follow up on Catalon Nubmer...
>
>
>
> On Fri, Jul 30, 2010 at 10:44 AM, Amit Jaspal wrote:
>
>> n is clearly a number lets say 3 then BST's with 1,2,3 values as key are
>> to be calculated
>>
>>
>> On Fri, Jul
The question is to find the no of structures possible for a BST which is
directly given bycomputing the catalan number for n(no of nodes)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegro
int num_of_BST(int n)
{
int sum=0;
int left,right,root;
if(n<=1)
return 1;
else
{
for(root=1;root<=n;root++)
{
left=num_of_BST(root-1);
right=num_of_BST(n-root);
sum+=left*right;
}
}
return sum;
}
On Thu, Jul 29, 2010 at 9:56 PM, amit wrote:
> Given the numbers from 1 to n, write an algorithm to
@abaove : sorry the formula stated prev is wrong. is (2n Cn)/(n+1) or
(2n!)/(n+1)!*n!
both being the same.
refer catalan numbers
--
Ramkumar.G
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@go
@sharad
BST is not unique, anyway the formula is correct
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@go
Follow up on Catalon Nubmer...
On Fri, Jul 30, 2010 at 10:44 AM, Amit Jaspal wrote:
> n is clearly a number lets say 3 then BST's with 1,2,3 values as key are to
> be calculated
>
>
> On Fri, Jul 30, 2010 at 9:08 AM, Apoorve Mohan wrote:
>
>> @AMIT: what does "n" represents?
>>
>>
>> On Fri, Jul
n is clearly a number lets say 3 then BST's with 1,2,3 values as key are to
be calculated
On Fri, Jul 30, 2010 at 9:08 AM, Apoorve Mohan wrote:
> @AMIT: what does "n" represents?
>
>
> On Fri, Jul 30, 2010 at 5:46 AM, sharad kumar wrote:
>
>> @amit is it BST or binary tree??cos BST is unique rite
@AMIT: what does "n" represents?
On Fri, Jul 30, 2010 at 5:46 AM, sharad kumar wrote:
> @amit is it BST or binary tree??cos BST is unique rite???binary tree meas
> use catalan numbers 2nCn/(n+1)!
>
>
>
> On Thu, Jul 29, 2010 at 9:56 PM, amit wrote:
>
>> Given the numbers from 1 to n, write an al
@amit is it BST or binary tree??cos BST is unique rite???binary tree meas
use catalan numbers 2nCn/(n+1)!
On Thu, Jul 29, 2010 at 9:56 PM, amit wrote:
> Given the numbers from 1 to n, write an algorithm to find how many
> distinct binary search trees can be formed.. eg n=4, no of distinct
> bs
Given the numbers from 1 to n, write an algorithm to find how many
distinct binary search trees can be formed.. eg n=4, no of distinct
bst's are 14. ??
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algog
10 matches
Mail list logo