- Qn 3 10 Points The Following Algorithm Seeks To Compute The Number Of Leaves In A Binary Tree Algorithm Leaf Counter 1 (66.92 KiB) Viewed 31 times
Qn 3: (10 points) The following algorithm seeks to compute the number of leaves in a binary tree. ALGORITHM Leaf Counter
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Qn 3: (10 points) The following algorithm seeks to compute the number of leaves in a binary tree. ALGORITHM Leaf Counter
Qn 3: (10 points) The following algorithm seeks to compute the number of leaves in a binary tree. ALGORITHM Leaf Counter (T) //Computes recursively the number of leaves in a binary tree //Input: A binary tree T //Output: The number of leaves in T if T = Ø return 0 else return LeafCounter (Tieft)+ LeafCounter (Tright) Is this algorithm correct? If it is, prove it; if it is not, make an appropriate correction.