42 Lab exercise printbylevel

 Background:

 

1.   A different kind of binary tree traversal scheme is to visit the nodes level by level.  Your task in this lab exercise is to print out a binary tree by level from left to right.  For example, this binary tree of letters (diagram below) will result in the following output of letters:

 

 

  M   E   R   A   J   P   T   G   N   Q   X   H

 

 

Assignment:

 

1.   Use the apqueue class to provide the necessary queue routines for this lab exercise.

 

2.   Starting with the earlier binary tree lab exercise in Lesson 39,  L.A.39.1, TreeStats, build a binary tree of characters ordered by letter.

 

3.   Write a function printLevel that prints out the tree, level by level from left to right.  The output can be formatted in one line as in the above example.  Any use of a queue is restricted to the operations allowed in the apqueue abstract data type.

 

Instructions:

 

1.   Use the same data files (FileA.txt) and (FileB.txt) as in the earlier binary tree lab in Lesson 39,  L.A.39.1, TreeStats.