Professional Documents
Culture Documents
Notes Ds
Notes Ds
return 0
else
return ( internal_nodes (tree->left) + internal_nodes(tree->right) + 1
Algorithm to determine the total no. of the nodes in the binary tree
Count ( left, right, root, num )
1. If root = NULL then set num = 0 and return.
2. Call count ( left, right, left[root], num_left)
3. Call count (left, right, right[root], num_right)
4. Set num = num_left + num_right + 1
5. Return