Page 1 of 1

Qn 3: (10 points) The following algorithm seeks to compute the number of leaves in a binary tree. ALGORITHM Leaf Counter

Posted: Fri Jul 01, 2022 5:46 am
by answerhappygod
Qn 3 10 Points The Following Algorithm Seeks To Compute The Number Of Leaves In A Binary Tree Algorithm Leaf Counter 1
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 32 times
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.