Tree Traversal 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.
9 years ago 10
Answer(1)
Purchase the answer to view it
NOT RATED
- BinaryTreeSolution.zip
other Questions(10)
- RESERVED FOR YTHOMIT
- FOR PHD ONLY
- Regarding the association areas of the cerebral cortex which of the following statements is most accurate
- Forum: "Confession" & "Small Frogs" - Free Verse Poetry Analysis
- LASA 2—Company Analysis Report
- FIN 571 WILEY WEEK 6 LATEST ONE. 100% SCORE
- lan
- QNT/351 Final Exam
- ES Writting assignment 5
- plant adaptations inculde the devolpment of water resistant ____________