Given the following definition of a node and binary search tree, write the member functions described below. You may declare and implement more functions if you need but you need to fully code any function you call. Any function you call will calculate towards runtime of your function. Please ensure that the run time requirement is met to get full marks class BST{ struct Node{ int data_; Node* left_; Node* right_; Node(int dat){ data_=dat; left_=right_=nullptr; } }; Node* root_; ... }; Write the following member functions of BST: bool BST::removeSmallest(int v); Runtime requirement O(log n) (assuming tree is balanced) This function removes the smallest value from subtree with root value of v
Given the following definition of a node and binary search tree, write the member functions described below. You may declare and implement more functions if you need but you need to fully code any function you call. Any function you call will calculate towards runtime of your function. Please ensure that the run time requirement is met to get full marks
class BST{
struct Node{
int data_;
Node* left_;
Node* right_;
Node(int dat){
data_=dat;
left_=right_=nullptr;
}
};
Node* root_;
...
};
Write the following member functions of BST:
bool BST::removeSmallest(int v);
Runtime requirement O(log n) (assuming tree is balanced)
This function removes the smallest value from subtree with root value of v


Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









