programming cpsc 121

programming cpsc 121

struct TreeNode {

string word;

TreeNode * left, right;

};

Note: A lot of your work from lab 9 can be reused or repurposed. Remember that working with a partner is encouraged!

Using Classes

Define a Tree class suitable for holding the Node struct defined above.

I have provided a header file and the .obj that accompanies it so you can see how a binary search tree is supposed to function; simply put both files into your project directory (where you’ve gotten your submission file all semester). I did not provide a main; just test your functions until you’re satisfied.

  1. I will provide a main to test your code; it will use all of your relevant functions appropriately if you use the included header file. If you do not use the provided header, you must provide a main file that presents the following menu to the user
    1. Add an item (asks user for item)
    2. Find an item (asks user for item)
    3. Show two stats for our current tree: number of nodes and maximum depth
    4. Display tree after asking user to choose from pre, in, or post order traversal
    5. Destroy the tree
    6. Destroy the tree and exit
  2. Return to step 2 if user did not choose f

There is a header file with suggested method declarations included.

Points:

2 – Documentation, readability, format

1 – Filename and Header

1 – Output testing

3 – Proper use of dynamic memory/data structures

3 – Proper use of classes

Extra Credit

  • Change the class so instead of having a string for data, you have a generic templated type – 1 Point
  • Submit before 12/8 – 0.5 Points

Header

//Author: Eric May (your name)

//CPSC 121 Lab 10

//<MM/DD/YY> (Current Date)

Filename

Your name is <Last Name><First Initial>

For example, my name would be MayE

This project is suitable for being split up into up to three files, although a single file is suitable for completion. If submitting multiple files, I want all of your submitted files in a .zip or .rar archive, named <Last Name><First Initial>.zip

The three potential files should be:

1.Header file with definition of class, method prototypes

2.Source file with our class’s methods’ definitions

3.Driver file that connects our class to a menu in main()

These three files can be named anything as long as the archive file follows the appropriate naming style. Don’t forget to include your header in all files you submit. If you wish to submit the project without submitting multiple files, you may do so at a slight point deduction

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper