treeSize implementation

This commit is contained in:
siepepa103492 committed 2026-11-12 15:17:58 +01:00
1 parent 51e5ba0db6
commit 1b09573787
1 file changed
+3 -2
+3 -2
View File
@@ -26,11 +26,12 @@ void *nextTreeData(TreeNode *root)
// Releases all memory resources (including data copies).
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 0;
return 1 + treeSize(root->left) + treeSize(root->right);
}