We created a structure called tree consisting of the following members:
- data: An integer member for storing integer data. Here, we're assuming that our tree only consists of integer elements.
- right and left pointers: These are used to point at the left and right child, respectively.
Internally, the tree will be maintained through an array; an integer array is defined of the size 20. For our purposes, let's assume that the user doesn't enter more than 20 elements for the tree. However, you can always increase the size of the macro to any larger number you desired.
The user is prompted to specify the number of elements they want to enter for the tree. Let's say the user wants to enter seven elements for the tree; ...