Data Structure Final Homework
A class of binary search tree MyTree is defined in which the following methods are implemented.
MyTree() // constructor: an empty tree is created
addNode(int v) //Value v is added to the tree following the rule for a binary search tree
print() //The values in the tree are printed following in-order traversal.
The method that you are asked to implement is a method called “printByLevel”
public void printByLevel()
This method prints the values in the tree by the levels. For example, if the tree is as below,
Image result for binary search tree