Why Choose Us?
0% AI Guarantee
Human-written only.
24/7 Support
Anytime, anywhere.
Plagiarism Free
100% Original.
Expert Tutors
Masters & PhDs.
100% Confidential
Your privacy matters.
On-Time Delivery
Never miss a deadline.
Implement a Binary tree
Implement a Binary tree. A binary tree is a tree that each
node has at most two children. Each node is an object containing a string.
2.Your binary tree class has to support the following functions:
(a) size(): Returns the number of nodes in the tree.
(b) addLeftChild(node parent,node Child): Adds a left child to the par- ent node
(c) addRightChild(node parent,node Child): Adds a right child to the parent node
(d) Ischild(): returns true if the node is the child of a given node and false otherwise.
(e) root(): which will return the Root.
(f) Height(): which will return the height of the tree;
3.insert the following into the tree. The root is a node containing the string:"Creature". The left child of root is a node containing the string:"Human". The Right Child of root is a node containing the string:"Animal". The left child of the node containing "Human" is a node containing the string:"alive"
and the right child of the node containing "Human" is a node containing the string:" dead". The right child of the node containing "Animal" is anode containing the string:"wild". And Animal does not have a left child.
4.implement the pre-order and post-order traversal algorithms discussed in the class to print the content of each of the nodes.
Expert Solution
Need this Answer?
This solution is not in the archive yet. Hire an expert to solve it for you.





