Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Node{
- int data;
- Node* left;
- Node* right;
- }
- int findHeight(Node *root){
- if(root == NULL){ //base case
- return -1;
- }else{
- return max(findHeight(root->left), findHeight(root->right))+ 1;
- }
- }
- int max(int a, int b){
- if(a >= b) return a;
- else return b;
- }
Add Comment
Please, Sign In to add comment