Guest User

Untitled

a guest
May 27th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. struct Node{
  2. int data;
  3. Node* left;
  4. Node* right;
  5. }
  6.  
  7. int findHeight(Node *root){
  8. if(root == NULL){ //base case
  9. return -1;
  10. }else{
  11. return max(findHeight(root->left), findHeight(root->right))+ 1;
  12. }
  13. }
  14.  
  15. int max(int a, int b){
  16. if(a >= b) return a;
  17. else return b;
  18. }
Add Comment
Please, Sign In to add comment