Create a test driver that exercises this new feature

Assignment Help Computer Engineering
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

Reference no: EM131261209

Questions Cloud

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.

Reviews

len1261209

10/29/2016 2:13:04 AM

Please see the project4A docx file in the attachment and then implement it. In the Project: Working With Binary Search Trees-Create a test driver that exercises this new feature, prints the tree and the results of this new operation and Create a test driver that exercises this new feature, prints the tree and the results of this new operation.

Write a Review

Computer Engineering Questions & Answers

  Research various command-line interfaces

List and explain some of the commands that are easier using a command-line interface versus using a GUI. List and explain some of the commands that are easier using a GUI versus using a command-line interface.

  Questionwhat are this errorsavaiofilenotfoundexception

questionwhat are this errors?ava.io.filenotfoundexception hangmanhangmanhandoutinput.txt the system cannot find path

  Could an until loop sometimes never execute

could an until loop sometimes never execute.

  Describe the process of evaluating the best dbms product

Describe the process of evaluating and selecting the best DBMS product. List examples of the requirements and features you used and justify any assumptions you make.

  Ssl protection

Explain whether pages are served over the SSL protected from problem you explained. If so, explain why; if not, explain why not.

  How to expand class linkedlisttype

Expand class linkedListType. Write down a function that returns the info of the kth element of the linked list. If no such factor exists, output an appropriate message.

  How to produce an average class with a public data

How to produce an Average class with a public data Produce an Average class with a public data member to collect the sum of integer entries and a public data member to hold the double average of the sum of the 10 integers.

  Create a program to read this list of prices

Wrtie down a program to read this list of prices and the sales table and calculate total dollar sales for each salesperson and the total dollar sales for all salespersons.

  Write program that generates casual number between 1 and 100

Write program that generates casual number between 1 and 100?

  Producing the random permutation

Write down a program which generates ten random permutations of numbers 1 to 10. To produce a random permutation, you require filling the vector with numbers 1 to 10 so that no two entries of vector have the same contents.

  Maintain planar motion

Describe how the mechanism is designed in order to maintain planar motion.

  Explain electrical and computer engineering

Electrical and Computer Engineering, Suppose Xt is a random process which is second-order stationary. Show that it is also stationary of order 1.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd