

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Page 1 of 2
You are expected to complete this program individually. See the syllabus for information about how you can help your classmates or seek help for various problems.
Each file should contain your name, the name of the file, and the assignment in a comment at the top of the file.
Develop and test a class that is a binary search tree where each node contains string data. Your solution will probably consist of four files if you follow the model of the linked list class discussed during lecture. Recall that a BST has the property that an inorder traversal produces the values in sorted order. Your class should be called stringBST and should provide the following public methods:
You can provide other methods if you want, but please be sure that these methods have exactly the signatures shown above, so I can run my test driver against your class. It is acceptable for this program to modify Java code that you saw in CMSC 221 to convert it to C++. Remember, the remove operation is complicated, so you may want to consult your 221 notes or textbook to refresh your memory on how it works.
You must also write and turn in a test driver program. For this project, your test driver should not be interactive; running it should conduct a series of tests and print out the results in an easy-to- read fashion. Remember the following things about designing test drivers:
Your test driver program should be called testBST.cpp.
Page 2 of 2
Extra credit: modify your BST to use templates as described in the class notes to create a BST class that can be used to store data of any type. Be sure to change the names of your files (and BST class) so that your extra credit submission doesn't conflict with the files from program 4.
Turn-in instructions
You will turn in your programs by running a script on the unix system that will copy your files into my account. For the first three programs, in a terminal window where you have cd'ed into the directory containing your source program, type:
~lbarnett/share/cs301_bst
You'll need to do this once for each one of the files. Don't forget to send me your test driver!
Grading notes
This time, I won't just be commenting on your test driver, I'll actually be deducting points for deficiencies in it, so don't just leave it until the last minute. In fact, it's probably a better idea to plan your test cases and write your test driver first. I'll also be paying attention to appropriate comments both in the class declaration (.h file) and in the bodies of the methods in your implementation file (.cpp file).