treeSize implementiert

This commit is contained in:
silvana884 2025-12-03 10:52:50 +01:00
parent c06f7c2b61
commit 1536413888

View File

@ -90,5 +90,10 @@ void clearTree(TreeNode *root)
// Returns the number of entries in the tree given by 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
}