Sorry that's shud have been node->right==node->right->left

On Sat, Jun 26, 2010 at 5:59 PM, Raj N <rajn...@gmail.com> wrote:

> #define max(x,y) ((x)>(y)?(x):(y))
>
> struct Bintree{
>       int element;
>       struct Bintree *left;
>       struct Bintree *right;
> };
>
> typedef struct Bintree* Tree;
>
> int height(Tree T)
> {
>       if(T->right==T->right->left)
>               return -1;
>       else
>               return (1 + max(height(T->left), height(T->right)))
> }
>
> Instead of checking the condition for node==NULL check if
> node->right->left. This has got nothing to do with BST by the way..
>
>
> On Sat, Jun 26, 2010 at 3:54 PM, divya jain <sweetdivya....@gmail.com>wrote:
>
>> yes..
>>
>> i got the solution traverse till node->right!=node->right->left... at this
>> point u ll get height.. rite?
>>
>> On 26 June 2010 11:49, Raj N <rajn...@gmail.com> wrote:
>>
>>> @Divya: What will happen when say node->right when you reach the leaves ?
>>> Is it equivalent to node->next and node->left = = node->previous in the
>>> doubly linked list ?
>>>
>>>
>>> On Tue, Jun 22, 2010 at 4:44 PM, divya <sweetdivya....@gmail.com> wrote:
>>>
>>>> a bst is given whose leaf nodes having left as well as right pointers
>>>> not pointing to NULL. rather all the leaf nodes are forming a circular
>>>> doubly linked list. u have to calculate height of tree.
>>>>
>>>> --
>>>> 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...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>>
>>>  --
>>> 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...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to