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
std::shared_ptr
};
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
The only files should be JltFinder.h and JltFinder.cpp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
