Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Tree_height(Node* node)
- {
- Node *htemp = node;
- int lcounter = 1;
- int rcounter = 1;
- if (node == NULL)
- {
- return 0;
- }
- if (htemp->left != NULL)
- {
- lcounter += Tree_height(htemp->left);
- }
- if (htemp->right != NULL)
- {
- rcounter += Tree_height(htemp->right);
- }
- if (lcounter >= rcounter)
- {
- return lcounter;
- }
- else
- {
- return rcounter;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement