generated from freudenreichan/info2Praktikum-DobleSpiel
treeSize implementiert
This commit is contained in:
parent
c06f7c2b61
commit
1536413888
@ -90,5 +90,10 @@ 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 numNodes;
|
||||||
|
}
|
||||||
|
return 1 + treeSize(root->left) + treeSize(root->right); //1, weil eine Wurzel gefunden wurde und dann immer plus eins fuer einen Teilbaum
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user