Question: Write a method: public void levelOrder(BinaryTree tree) that would perform a level-order traversal of the specified binary tree, tree, printing the entry at each node
Write a method:
public void levelOrder(BinaryTree tree)
that would perform a level-order traversal of the specified binary tree, tree, printing the entry at each node as it is visited. Use a queue initially containing the root of the tree. Iterate as long as the queue is not empty. Visit a dequeued node, and enqueuer all its children.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
