From 1b09573787602c75d9d77de1518bc3a544d0897e Mon Sep 17 00:00:00 2001 From: Pascal Siepe Date: Thu, 12 Nov 2026 15:17:58 +0100 Subject: [PATCH] treeSize implementation --- Startcode/bintree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Startcode/bintree.c b/Startcode/bintree.c index 5cf82a9..ce4a24c 100644 --- a/Startcode/bintree.c +++ b/Startcode/bintree.c @@ -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); } \ No newline at end of file