Created
May 24, 2018 02:18
-
-
Save reyou/2aff166615885adbfe75a002e0af6660 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// number edges in longest path | |
// depth and height are different properties | |
struct Node | |
{ | |
int data; | |
struct Node *left; | |
struct Node *right; | |
} | |
int FindHeight(struct Node *root) | |
{ | |
if (root == NULL) | |
{ | |
return -1; | |
} | |
return max(FindHeight(root->left), FindHeight(root->right)) + 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment