Question: please write in c++ a) Implement private member function for our OrderedSet class with the prototype below: static Node findParent( Node n, int target); The

please write in c++
please write in c++ a) Implement private member function for our OrderedSet

a) Implement private member function for our OrderedSet class with the prototype below: static Node findParent( Node n, int target); The function's job is to return a pointer to the parent of the Node with value target, or return nullptr if target is not found. NOTE: we are also going to return nullptr in the special case where the target happens to be in Node n, since we couldn't return a pointer to n's parent in that case For the sake of efficiency, you should assume that the tree with root n is a binary search tree and use that fact to limit the search. That's appropriate since findParent() will be called from member functions of OrderedSet, where the trees are always BST's. b) Implement the public member function bool contains(int target) const; The function's job is to return true if target is in the tree and false otherwise. DO NOT use a loop or recursion. Just use if statements and a suitable call to findParent() from Part a. This time JUST copy paste your two functions without pasting the entire program. (That will make it easier for me to grade your code.) Naturally, you should make sure that your code works for example by adding some test cases that call contains()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!