Reference no: EM131261209
Project: Working With Binary Search Trees
Complete the following exercises using the cs20::BST class presented in class.
1. Without using a TreeIterator, create a new method called total that takes an no arguments and determines that the sum of all the elements stored in the BinarySearchTree. If the root of the tree is nullptr, then your method should throw an InvalidTreeArgument exception. The prototype of this method should be:
int BST< Object >::total( ) const throw( InvalidTreeArgument );
Because the method has been marked const, your implementation will not be able to change any of the data members found in the BinarySearchTree. Instead, you should use recursion to walk all the nodes in the tree and return the total seen so far in the recursive stack.
Create a test driver that exercises this new feature, prints the tree and the results of this new operation.
2. Without using a TreeIterator, create a new method called isMatchingTree that takes an BST parameter and determines if this tree has the exact same matching structure as the passed parameter. In other words, the exact same data values need to be found in both trees in the exact same structural arrangement. If the root of the tree is nullptr, your method should throw an InvalidTreeArgument exception. The prototype for this method should be:
bool BST< Object >::isMatchingTree( BST< Object >otherTree ) const throw( InvalidTreeArgument );
Because the method has been marked const, your implementation will not be able to change any of the data members found in the BinarySearchTree. Instead, you should use recursion to walk all the nodes in the tree and verify that the same matching element value is found in each node.
Create a test driver that exercises this new feature, prints the tree and the results of this new operation.
Attachment:- Assignment.zip
Explore the characteristics of your chosen ethical theory
: Next, identify the characteristics of your chosen ethical theory and its notion of the moral good. For the latter, you will need to review again the PowerPoint that was introduced in Week One.
|
Estimate time it will take to complete 5th liver transplant
: Estimate the time it will take to complete the 5th liver transplant, all of the first 5 transplants, and the 18th transplant.
|
Impact of collective bargaining on employee behavior
: Unit Assignment: For this assignment, you will discuss the impact of collective bargaining on employee behavior, and you will evaluatetraining and development methods for various types and levels of organizations.
|
Impact of collective bargaining on employee behavior
: Unit Assignment: For this assignment, you will discuss the impact of collective bargaining on employee behavior, and you will evaluatetraining and development methods for various types and levels of organizations.
|
Create a test driver that exercises this new feature
: Without using a TreeIterator, create a new method called total that takes an no arguments and determines that the sum of all the elements stored in the BinarySearchTree. Create a test driver that exercises this new feature, prints the tree and the ..
|
What type of pump is best suited for this system
: Assuming a reasonable efficiency from an appropriate pump curve, estimate the power in kilowatts required to operate the pump.
|
Identify ethical theory that supports your moral position
: Ethical theory. In the same second paragraph as the thesis statement, identify the ethical theory that supports your moral position. You may choose from utilitarianism, duty ethics, or virtue ethics.
|
Efforts developing consumer apps
: Should The Weather Company expend its efforts developing consumer apps, or should it focus on its professional services division, offering weather and biometeorological analytics to its business customers? Could they effectively do both?
|
Statistical engineering frameworks
: Compare and contrast the fundamental differences between process improvement framework and problem solving framework. Provide one (1) example of business management applying each framework to support your response.
|