Create a class for a binary 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:

a null constructor

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.

preorder -- iterate ( list all nodes in order according to the preorder traversal of the tree)
inorder -- iterate ( list all nodes in order according to the inorder traversal of the tree)
postorder -- iterate ( list all nodes in order according to the postorder traversal of the tree)
search -- given a key value, tell us whether or not the integer is in the tree.
max -- return the maximum value in the tree
min -- return the minimum value in the tree
insert
delete
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
Reference No:- TGS01956595

Now Priced at $30 (50% Discount)

Recommended (93%)

Rated (4.5/5)