subject

In a C++ class definition for an abstract data type WordTree of strings, store the words and the counts of the words in a single binary search tree. Each word occurring in the text can only be stored once in the tree. Implement each member function in the class below. The WordTree class may have only one member variable, root, and it must be private. provide an appropriate copy constructor, destructor and assignment operator for the WordTree class as well. #include
#include
using namespace std;
typedef string ItemType;
struct WordNode {
ItemType m_data;
WordNode *m_left;
WordNode *m_right;
// You may add additional data members and member functions in WordNode
};
class WordTree {
private:
WordNode *root;
public:
// default constructor
WordTree() : root(nullptr) { };
// copy constructor
WordTree(const WordTree& rhs);
// assignment operator
const WordTree& operator=(const WordTree& rhs);
// Inserts val at the front of the list
void add(ItemType v);
// Returns the number of distince words / nodes
int distinctWords() const;
// Returns the total number of words inserted, including duplicate
// values
int totalWords() const;
// Prints the LinkedList
friend ostream& operator<<(ostream &out, const WordTree& rhs);
// Destroys all the dynamically allocated memory
// in the tree.
~WordTree();
};

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:40
What are the three parts to physical security standards for various types of army equipment and the risk level
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
What are ways to switch windows in excel? check all that apply. on the status bar, click the windows button, and then click the file name. on the task bar, click to display the excel jump list, and then click the file name. on the view tab, in the window group, click switch windows, and then click the file name. on the review tab, in the viewing group, click files, and then click the file name.
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Font size, font style, and are all aspects of character formatting.
Answers: 2
question
Computers and Technology, 24.06.2019 01:00
Mastercard managers are motivated to increase (1) the number of individuals who have and use a mastercard credit card, (2) the number of banks and other clents who issue mastercards to customers and/or employees, and (3) the number of locations that accept mastercard payments. discuss how mastercard could use its data warehouse to it expand each of these customer bases.
Answers: 3
You know the right answer?
In a C++ class definition for an abstract data type WordTree of strings, store the words and the cou...
Questions
question
Mathematics, 20.12.2019 13:31
Questions on the website: 13722367