diff --git a/bintree.c b/bintree.c index cd4571a..1e34db0 100644 --- a/bintree.c +++ b/bintree.c @@ -189,5 +189,9 @@ void clearTree(TreeNode *root) // Returns the number of entries in the tree given by root. unsigned int treeSize(const TreeNode *root) { - + if (root == NULL) { //0 for end + return 0; + } + return 1u + treeSize(root->left) + treeSize(root->right); //using 1u to insure unsigned + //recursively adds entries in the tree after root to left and right } \ No newline at end of file