Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C + + Task 1 . Binary Tree Class Using the lecture material as a guide create a binary tree class. This class should

In C++ Task 1. Binary Tree Class
Using the lecture material as a guide create a binary tree class. This class should be generic so that it will operate on any given type.
Your class should have the following functionality:
Binary Tree Functions
Function Description
insert Insert a node into the proper location of the tree
remove Remove a specific node from the tree
contains Report is the tree contains a specific piece of data
findMin Find and return the smallest value in the tree
findMax Find and return the largest value in the tree
isEmpty Determine if the tree is empty
printTree Visit each node in the tree and print the data to the screen.
Task 2. AVL Tree Class
Using the code you created in task 1 as a guide create an AVL tree. If done properly you should be able to use a great deal of functionality from your Binary Tree class and add the code to balance the tree. Your class should balance the tree whenever a node is inserted or removed. This means you will probably have to keep track of when a sub tree is taller and shorter than the other. Feel free to modify the node as needed.
Task 3. The Word Count Class
Create a WordCount class that uses the AVL tree class to count words from a file. The trick here is that you should not have duplicate words in the list. Basically when a word is read from the file the tree should be checked to see if the word already exists in the tree. If it does exists the count for the word should simply be incremented. If it does not exist then the node should be added to the tree and the count for that particular word should be set to 1. You should have functionality that will print each word in the tree and how many times it appears.
Please Note
This is not simply reading a list of words from a file. Your WordCount class should read any text from the file and count the words in it. This is going to require a bit of parsing on your part. Please discard punctuation characters like comma and period.
Here is a text file you can use to test your programDownload Here is a text file you can use to test your program
Output
You should output a list of words and the number of times they appear in the file. Here is an example of what the output should look like:
Dorothy -2
for -5
is -7
Please Note: Do not use absolute paths when reading and writing to files. Your should simply use the file name without any path. This is going to require the you put the file in the appropriate file of your project.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

What is push technology?

Answered: 1 week ago

Question

explain the marketing audit and SWOT analysis

Answered: 1 week ago

Question

=+3. What is content curation and its role within social media?

Answered: 1 week ago

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago