Dana Vrajitoru
C243 Data Structures

C243/A594 Homework 7

Due date: Wednesday, October 23, 2019.

Ex. 1. a. Download the following files:
tree.cc
tree.h
interface.cc
interface.h
main.cc
Makefile

a. For this homework, you must supply the code for six of the functions present in the file tree.cc.

The files contain the implementation of a binary tree structure and of some functions to manipulate it. Moreover, the files contain some functions to test this structure and the manipulation functions. To compile this program you should use the command make and to run the program you should use the command btree.

b. To feed data to this program without having to type it every time, you can use the Unix-Linux redirection option "<". For example, we'd like to run the program by taking the input from the following file:

tree.txt

For this, download the file into the same directory as your program and run the program again with the following command:

btree < tree.txt

This should create a tree that looks the following way:

Modify this file to test the functions that you have implemented after it builds the tree. Thus, after printing the tree, it should

and then quit. Feel free to change some of the values in the tree to 0 or to negative numbers for the test, or to add more nodes to it.

If the result of the program is too long and you wish to see the entire content of the output, you can also redirect the output into a file with the following command:

btree < tree.txt > res.txt
Thus, once the program has finished its execution, you can examine the file "res.txt" to see what has happened in your program.

Upload to Canvas: the source files that you modified: tree.cc and any other you change, and the modified input file tree.txt.