Question: C++ Programming (Please Help!) Checking point 2: Binary Tree 1. Write your own version of a class template that will create a binary tree that

C++ Programming (Please Help!)

Checking point 2: Binary Tree

1. Write your own version of a class template that will create a binary tree that can hold values of any data type.

Then add the following member functions to your defined class template.

2. Write a member function that counts and returns the number of nodes in the tree

3. Write a member function that counts and returns the number of leaf nodes in the tree.

4. Write a member function that returns the height of the tree. The height of the tree is the number of levels it contains. For example, the tree shown in the following figure has four levels

C++ Programming (Please Help!) Checking point 2: Binary Tree 1. Write your

Figure 1.

5. Write a member function that returns the width of the tree. The width of the tree is the largest number of nodes in the same level. For example, the Figure 1, the width of the tree is 3.

6. Demonstrate the above member functions by your test program.

(C++ Programming)

8 10 1 6 14 4 7 (13

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!