//address of root node of the tree is passed to this function
int treeSize(struct node* node)
{
if (node==NULL)
{
return 0;
}
else
{
return (treeSize(node->left) + treeSize(node->right) + 1);
}
}
int treeSize(struct node* node)
{
if (node==NULL)
{
return 0;
}
else
{
return (treeSize(node->left) + treeSize(node->right) + 1);
}
}
No comments:
Post a Comment