Question: Create the following tree and implement the following functions and give their outputs: a) int count_leaf(TNode *root) ; //returns the total number of leaf nodes

Create the following tree and implement the following functions and give their outputs:

4 3 5 5 4 7 9 (14) 9 (14) 15 (16)

a) int count_leaf(TNode *root) ; //returns the total number of leaf nodes in the tree

b) int count_nonleaf(TNode *root) ; //returns the total number of non-leaf nodes in the tree

c) bool isleaf(TNode *root, int value) ; //checks if the queried node is a leaf


4 3 5 5 4 7 9 (14) 9 (14) 15 (16) (18) (17) (20)

Step by Step Solution

3.46 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Solution CODE include include using namespace std struct node int data struct ... View full answer

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 Programming Questions!