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
+2 -1
+2 -1
View File
@@ -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);
} }