- #1
Faris1985
- 3
- 0
Q.When run the program should ask for an input file containing integer keys to be added to the
search tree. The file will contain one key per line. Add these keys in the order given in the file to
the search tree. Then print the entire tree using preorder traversal i.e., root, left-child, right-child.
The output must be indented properly to show the appropriate levels.
For example, if the input keys are 4, 3, 7, 8, 6. The output should look like this
4
<2 spaces>3
<2 spaces>7
<3 spaces>6
<3 spaces>8I have made the tree. How do I go about printing it as shown above?? ANY help would highly be appreciated.
search tree. The file will contain one key per line. Add these keys in the order given in the file to
the search tree. Then print the entire tree using preorder traversal i.e., root, left-child, right-child.
The output must be indented properly to show the appropriate levels.
For example, if the input keys are 4, 3, 7, 8, 6. The output should look like this
4
<2 spaces>3
<2 spaces>7
<3 spaces>6
<3 spaces>8I have made the tree. How do I go about printing it as shown above?? ANY help would highly be appreciated.
Last edited: