Educational Objectives: After completing this assignment, the student should be able to accomplish the following:
Operational Objectives: Implement class templates InorderBTIterator, LevelorderBTIterator, and ThreadedBTIterator and use these classes to complete the implementations of the class templates BST_Threaded, BST_ADT, and RBLLT_ADT.
Deliverables: Five files:
bt2iter.h # contains the iterator class templates bst_adt.h # class BST_ADT bst_threaded.h # class BST_Threaded rbllt_adt.h # class RBLLT_ADT log.txt # your project work log
To create the various classes from "scratch" (or "whole cloth") is a large and somewhat open-ended project that is not at all beyond the capabilities of students at your level. But it would be much too much work. Therefore you have the task of completing an implementation that has been worked out and for which many of the technical details have been supplied. This leaves you with a different, but more manageable, two-part mission:
Regarding I. There are several classes involved that are inter-related, as follows:
template < class C > InorderBTIterator; template < class C > ThreadedBTIterator; template < class C > LevelorderBTIterator;
These take a parameter C that is treated as a binary tree class built from nodes with certain properties. Any class C that has an interface and structure assumed by the iterator classes will work with them.
The two iterator classes InorderBTIterator and ThreadedBTIterator are fully functional bidirectional iterator types (see notes on Iterators). The class LevelorderIterator is a fully functional forward iterator class.
template < typename T , class P > BST_BASE; // in file bst_base.h template < typename T , class P > BST_ADT; // in file bst_adt.h, derived from BST_BASE template < typename T , class P > BST_Threaded; // in file bst_threaded.h, derived from BST_BASE template < typename T , class P > RBLLT_ADT; // in file rbllt_adt.h, derived from BST_ADT
These classes are all variations on BST. The separation of many of the functionalities into the base class BST_BASE serves mainly (and not insignificantly!) as a code re-use mechanism. BST_BASE does not define its own Iterator type. The two derived class offer variations on choice of Iterator.
The official development | testing | assessment environment is gnu g++47 -std=c++11 -Wall -Wextra on the linprog machines.
Create and work within a separate subdirectory cop4530/proj2.
Begin by copying all files in the directory LIB/proj2 into your proj2 directory. At this point you should see these files in your directory:
bt2iter.start # partial BT iterator classes bst_adt.start # partial class BST w ADT iterators, derived from BST_BASE bst_threaded.start # partial class BST w threaded iterators, derived from BST rbllt_adt.start # partial implementation of RBLLT, derived from BST fbst.cpp # test harness for all the BST classes ranstring.cpp # random string generator ranuint.cpp # random uint generator makefile # builds 15 test exectuables and 2 utilities
Then copy these relevant executables from LIB/area51/:
fbst*.x frbllt*.x mbst*.x mrbllt*.x
Create the file bt2iter.h, bst_adt.h, bst_threaded.h, rbllt_adt.h containing the template classes.
Test thoroughly.
Submit the assignment using the script proj2submit.sh.
Warning: Submit scripts do not work on the program and
linprog servers. Use shell.cs.fsu.edu to submit assignments. If you do
not receive the second confirmation with the contents of your assignment, there has
been a malfunction.
Don't change the code already in the distributed files.
Complete the implementations where there is missing code.
Note that fbst.cpp has 4 possible ElementType definitions and 3 possible BST definitions that can be selected by the comment/uncomment technique. You need to use that technique to proliferate fbst.cpp to these tests:
fbst_adt_CHAR.cpp fbst_adt_int.cpp fbst_adt_String.cpp fbst_threaded_CHAR.cpp fbst_threaded_int.cpp fbst_threaded_String.cpp frbllt_adt_CHAR.cpp # also uncomment the 'h' case and the Rehash line in the menu frbllt_adt_int.cpp # also uncomment the 'h' case and the Rehash line in the menu frbllt_adt_String.cpp # also uncomment the 'h' case and the Rehash line in the menu
Similarly, mbst.cpp proliferates to
mbst_adt_int.cpp mbst_adt_String.cpp mbst_threaded_int.cpp mbst_threaded_String.cpp mrbllt_adt_int.cpp mrbllt_adt_String.cpp
You need to create these tests, each of which is required by the makefile