Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. struct Node {
  2. int value;
  3. Node *left;
  4. Node *right;
  5. }
  6.  
  7. int heightOfTree(Node node){
  8. if(node ==NULL)
  9. {
  10. return 0;
  11. }
  12. else
  13. {
  14. int lheight=heightOfTree(node->left);
  15. int rheight = heightOfTree(node->right);
  16. if(lheight>rheight)
  17. {
  18. return lheight;
  19. }
  20. else
  21. {
  22. return rheight;
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement