Assignment 6 : CIS 208

Assigned: March 11th, 2005
Due: Monday, March 28th, 2005,    by 5:00 PM. 
 

Turn in hard copies to the CIS Main office and
email your source code (not compiled programs) to sdg5476@ksu.edu.

This assignment is worth 15 points.

Write a C program that uses a binary search tree to sort characters from either a file,
or from the user.  The user may decide to either print the contents of the tree (in ascii order)
to the console, or reset the tree by deleting it.

Specifically:
1)A user interface should allow the user to choose to either type in a string, or the name
of a file; print out the tree; reset the tree, or quit the program.

2) The structure needs to be a binary search tree.  This structure has a single data element,
and two pointers to its children.  These are called the left and right branches.  In a binary
search tree, every element in the left subtree has a value less than the root element,
and every element in the right subtree has a value greater than the root element.  Such an order makes
sorted insertion into the tree easy and efficient. 

3)Make no assumption on the total number of characters that can be added to the tree. 
However, you may assume that the user will never type in more than 80 characters per string.
File names can also be less than 80 characters, but there is no limit to the number of characters'
within the file.

4)Duplicate character values should not be added to the tree.  So there should only be at most
one instance of character 'a',  one instance of character 'A', and so on. 

5) When printed out, the tree should display the its contents in ascii numerical order.  Print
it out all on one line.

6) Avoid any and all memory leaks.  If you create memory, deallocate it before the program
exits. 

7) If you wish, you may store your tree structure in separate library files.

EXTRA CREDIT (10 Points)
Provide a delete node functionality.  Prompt the user to input a character.  If this character
is within the tree,  then remove it.  Preserve tree order after your deletion.