generated from freudenreichan/info2Praktikum-DobleSpiel
treeSize implementation
This commit is contained in:
1 parent
51e5ba0db6
commit
1b09573787
1 file changed
+2
-1
+2
-1
@@ -32,5 +32,6 @@ void clearTree(TreeNode *root)
|
|||||||
// Returns the number of entries in the tree given by root.
|
// Returns the number of entries in the tree given by root.
|
||||||
unsigned int treeSize(const TreeNode *root)
|
unsigned int treeSize(const TreeNode *root)
|
||||||
{
|
{
|
||||||
|
if(root == NULL) return 0;
|
||||||
|
return 1 + treeSize(root->left) + treeSize(root->right);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user