Create a class for a binary tree named bt each node in tree


Assignment

Create a class for a binary tree named BT. Each node in the tree should have data, a reference to the node's left sub-tree, and a reference to the node's right sub-tree. For the purposes of this project, the data in the nodes can be integers.

The binary tree should have a height property, a size property, which is the number of nodes in the tree, and the following methods:

1. a null constructor

2. a constructor that builds a tree from a specified array of integers. The tree does not need to be a balanced tree.

Note: remember to address the height and size properties when building a tree from a specified array.

1. preorder -- iterate ( list all nodes in order according to the preorder traversal of the tree)
2. inorder -- iterate ( list all nodes in order according to the inorder traversal of the tree)
3. postorder -- iterate ( list all nodes in order according to the postorder traversal of the tree)
4. search -- given a key value, tell us whether or not the integer is in the tree.
5. max -- return the maximum value in the tree
6. min -- return the minimum value in the tree
7. insert
8. delete
9. destroy

Test each method to ensure that it works properly.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Create a class for a binary tree named bt each node in tree
Reference No:- TGS02509251

Now Priced at $55 (50% Discount)

Recommended (99%)

Rated (4.3/5)