Wednesday, April 23, 2014

No.of Nodes in a Tree

int Count(Node root)
{
   if(root == NULL)
      return 0;
   return 1 + Count(root->left) + Count(root->right);
}

No comments:

Post a Comment