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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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