Skip to content

Instantly share code, notes, and snippets.

@reyou
Created May 24, 2018 02:18
Show Gist options
  • Save reyou/2aff166615885adbfe75a002e0af6660 to your computer and use it in GitHub Desktop.
Save reyou/2aff166615885adbfe75a002e0af6660 to your computer and use it in GitHub Desktop.
// 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