(Level-Order Binary Tree Traversal) The program of Figs.19.20–19.22 illustrated three recursive methods of traversing a binary tree—inorder, preorder and postorder traversals. This exercise presents the level-order traversal of a binary tree, in which the node values are printed level by level, starting at the root node level. The nodes on each level are printed from left to right. The level-order traversal is not a recursive algorithm. It uses a queue object to control the output of the nodes. The algorithm is as follows:
1) Insert the root node in the queue
2) While there are nodes left in the queue,
Get the next node in the queue
Print the node’s value
If the pointer to the left child of the node is not nullptr
Insert the left child node in the queue
If the pointer to the right child of the node is not nullptr
Insert the right child node in the queue.
Write member function levelOrder to perform a level-order traversal of a binary tree object. Modify the program of Figs. 19.20–19.22 to use this function. [Note: You’ll also need to modify and incorporate the queue-processing functions of Fig.19.16 in this program.]
Fig. 19.20 Creating and traversing a binary tree. (Part 1 of 3.)

Fig. 19.20 Creating and traversing a binary tree. (Part 2 of 3.)

Fig. 19.20 Creating and traversing a binary tree. (Part 3 of 3.)

Fig.19.21 TreeNode class-template definition. (Part 1 of 2.)

Fig. 19.21 TreeNode class-template definition. (Part 2 of 2.)

Fig. 19.22 Tree class-template definition. (Part 1 of 3.)

Fig. 19.22 Tree class-template definition. (Part 2 of 3.)

Fig. 19.22 Tree class-template definition. (Part 3 of 3.)

Fig.19.16 Queue class-template definition. (Part 1 of 2.)

Fig. 19.16 Queue class-template definition. (Part 2 of 2.)

We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.