Programming II Binary tree insertion and traversals

Assignment: Write a program that inserts identifiers in a binary tree. Print the tree four (4) times. Print a graphical representation of the tree where the depth ofeach node is indented a multiple of five (5) spaces and lexicographically
smaller nodes are printed before larger nodes. List the node of the tree
three times, once using a preorder traversal, once using an inorder
traversal, and once using a postorder traversal.
Prohibition: Use of the C++ Standard Template Library is prohibited in the
implementation of this project.
Program Files: Project 8 consists of files p08.cpp, Tree08.h, Tree08.cpp, and p08make.
Project file names are exactly as given. Failure to employ the foregoing
names will result in a score of zero (0) for this project
Project files must be stored in the root directory of your student account. Failure to store project files in the root directory of your student account will result in a score of zero (0) for this project.
File Description
p08.cpp File p08.cpp contains functions that process command line
arguments. File p08.cpp contains functions create and
traverse a binary tree.
Tree08.h File Tree08.h contains the definition of class Tree. Class
Tree implements a binary tree by dynamically allocating
nodes. Each node references an identifier.
Tree08.cpp File Tree08.cpp contains the implementation of member
functions of class Tree.
p08make File p08make contains instructions for creating executable
file p08. Instructions in file p08make are accepted by the
UNIX utility make.
Command Line: Project 8 can be invoked with zero, one, or two program parameters. The
first program parameter is the input file name. The second parameter is
the output file name. Sample command lines together with corresponding
actions by program p08 are shown below. Boldfaced type indicates data
entered at the keyboard by the user.
$ p08
Enter the input file name: i08.dat
Enter the output file name: o08.dat
$ p08 i08.dat
Enter the output file name: o08.dat
$ p08 i08.dat o08.dat
Input files: The input file contains a list of identifiers similar to the list given in Figure
1.
Output files: Identifiers given in the input file are listed four (4) times in the output file.
Figure 2 illustrates how program p08 lists the identifiers given in Figure 1.
Figure 1.
Input file format: fantine rachel ilse karen deborah abigail zoe
 
Figure 2.
Output file
format:
Graphical Representation
abigail
deborah
fantine
ilse
karen
rachel
zoe
Preorder Traversal
fantine
deborah
abigail
rachel
ilse
karen
zoe
Inorder Traversal
abigail
deborah
fantine
ilse
karen
rachel
zoe
Postorder Traversal
abigail
deborah
karen
ilse
zoe
rachel
fantine
Powered by