Advertisement
Guest User

Untitled

a guest
May 15th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. int NodeCount(TREE * node)
  2. {
  3.     int leftchild, rightchild;
  4.     if (node->left == NULL && node->right == NULL)
  5.         return 1;
  6.     if (node->left != NULL)
  7.         leftchild = NodeCount(node->left);
  8.     else
  9.         leftchild = 0;
  10.     if (node->right != NULL)
  11.         rightchild = NodeCount(node->right);
  12.     else
  13.         rightchild = 0;
  14.  
  15.     return leftchild + rightchild + 1;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement