Question: Code in C++ and include the methods below. Given a binary search tree and a number n, find the node in the tree that contains

Code in C++ and include the methods below.

Given a binary search tree and a number n, find the node in the tree that contains the largest number that is less than n. If there is no value in the tree less than n then return nullptr. The binary search tree over which you will search will be given as a parameter. The Node interface is as follows: class Node {

public:

Node(int);

~Node();

int getValue();

std::shared_ptr getLeft();

std::shared_ptr getRight();

};

The public interface of your JltFinder class must include the following:

//public constructor, receives the root of the binary search tree over which to search.

JltFinder(std::shared_ptr);

//search for the node with the value closest to but less than the value provided.

std::shared_ptr Find(int);

The only files should be JltFinder.h and JltFinder.cpp

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!