Yup dudes .... I agree it was a wrong program .... I have put the
proper indentation without proper braces .... and that makes the code
incorrect.

The correct program would be :

int getheight ( node *p )
{
    if ( p==NULL )
        return 0;
    else
    {
        rh = getheight ( p->right );
        lh = getheight ( p->left );
        return ( (lh>rh ? lh : rh)+1 );
    }
}

It's amazing to know that I can still make such silly mistakes after
coding in C for 3+ yrs.

Thanks to all those fellows who pointed out the error. I am really
sorry for it.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to