Question: Let T be a proper binary ttree with root r. Consider the following algorithm. 5. Let T be a proper binary tree with root r.
Let T be a proper binary ttree with root r. Consider the following algorithm.

5. Let T be a proper binary tree with root r. Consider the following algorithm Algorithm traverse(r) Input: Root r of a proper binary tree. if r is a leaf then return 0 else ttraverse(left child of r) ?traverse(right child of r) return s+t+1 What does the algorithm do? (A) It computes the height of the tree. (B) It computes the number of nodes in the tree. (C) It computes the number of nodes in the tree plus 1. (D) It computes the number of leaves in the tree. (E) It computes the number of internal nodes in the tree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
