Recursion algorithm to find out the size of a binary tree:
int treeSize(struct Tree *node)
{
if(node == NULL) return 0;
else
return treeSize(node->left) + 1 + treeSize(node->right);
}
For other tree operations and complete code refer: click here
int treeSize(struct Tree *node)
{
if(node == NULL) return 0;
else
return treeSize(node->left) + 1 + treeSize(node->right);
}
For other tree operations and complete code refer: click here
No comments:
Post a Comment