EECS268:Lab7
From ITTC
Navigation |
---|
Home |
Information |
Classwork |
Contents
Due time
This lab is due Friday July24th by 11:59pm
Lab conduct
- Do not use any unauthorized aid, such sites like rentacoder or chegg to obtain answers
- Do not use code provided by another student
- Do not reuse code (by you or anyone) from prior semesters
- If you need help, seek it from:
- Your lab TA.
- Me, Dr. Gibbons, my email is jwgibbo@ku.edu / jwgibbo@gmail.com
- If equipment you don't own (e.g. cycle servers) needs attention or you're having account issues put in a ticket!
Overview
This lab is a continuation on your BST data structure. We will be adding feature to it and the program as a whole.
Binary Search Tree: Phase 2
In addition to the old functionality, your menu must also allow the user to ...
Copy | Creates a deep copy of the BST. The user is allowed have at most two BSTs at a time (for your sake). Once a copy is made you'll need to ask the user which tree, original or copy, they want to interact with. Should the user try to make multiple copies, print an error. |
---|---|
Remove | Remove a Pokemon from the BST. Obtain an pokedex number (ID) and remove that entry from the BST. |
Prompt the user for the following:
| |
Quit | Exits the program |
BST Interface (Updated)
tempate <typename ItemType, typename KeyType> class BinarySearchTreeInterface { public: virtual ~BinarySearchTreeInterface(){} virtual void add(ItemType entry) = 0; //throws std::runtime_error if duplicate added virtual ItemType search(KeyType key) const = 0; //throws std::runtime_error if not in tree virtual void clear() = 0; virtual void remove(KeyType key) = 0; //throws std::runtime_error if not in tree //For the following methods, each method will take a function as a parameter //These function then call the provided function on every entry in the tree in the appropriate order (i.e. pre, in, post) //The function you pass in will need to a static method virtual void visitPreOrder(void visit(ItemType)) const = 0; //Visits each node in pre order virtual void visitInOrder(void visit(ItemType)) const = 0; //Visits each node in in order virtual void visitPostOrder(void visit(ItemType)) const = 0; //Visits each node in post order };
Rubric
- 45% Pokedex Interaction
- 5% Searching
- 5% Adding entry
- 15% Deep copying of BST
- 35% Removing entry
- 20% Terminal output
- 10% proper traversal order
- 10% well formatted output
- 10% Program stability
- 5% Logical user interface
- 5% Needed Operators overloaded