logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Alexis JiangEducation
(5/5)

656 Answers

Hire Me
expert
Piper SharpMathematics
(5/5)

720 Answers

Hire Me
expert
Ernest BanisterComputer science
(5/5)

962 Answers

Hire Me
expert
Stanley BaxterComputer science
(5/5)

962 Answers

Hire Me
C++ Programming

Write two find methods that takes one int parameter, which will be the value to search for. The method returns a pointer to the node containing the value if the value is found

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Programming Assignment 2

Create the BST below by inserting nodes in the correct order to give the tree structure below:

Write two find methods that takes one int parameter, which will be the value to search for. The method returns a pointer to the node containing the value if the value is found, and returns a null pointer otherwise.

 

One method, find1, will use iteration (not recursion).

The second method, find2, will call a private helper method also named find2 that takes two parameters, the int to search for, and the root node of a sub-tree to search in. The private method will be recursive.

 

Make the methods print what they are doing as follows:

 

If the current node is null, print 'Not Found', if the value is found at the current node, print 'Found', if the current node contains a value not equal to the value searched for, print the value at the current node, and print 'Searching Left' or 'Searching Right', depending on which sub-tree the function will look in next.

 

For example, for the tree diagrammed above, t.find1(30); should print:

40 Searching Left

20 Searching Right Found

Download and run the program BST_03.cpp

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

333 Experts Online