Question: 4. (18 pts) Write a simple recursive function to calculate (and return) the length of the shortest path (from root to a leaf node) in

4. (18 pts) Write a simple recursive function to calculate (and return) the length of the shortest path (from root to a leaf node) in a given general binary tree T. The length of the shortest path is equal to the number of edges along the path from the root to the highest leaf. See the example below: You can assume the following tree node structure: class Node // this is a fragment; would generally need member functions { Node *pLeft; // points to the left subtree Node *pRight; // points to the right subtree int mData; }; in c++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!