Question: void deleteNode(T k) Deletes the node with the given key such that the AVL (or BST) property holds. As convention, while deleting a node with
void deleteNode(T k) Deletes the node with the given key such that the AVL (or BST) property holds. As convention, while deleting a node with 2 children, the new root should be selected from the right subtree.
Code the following function in c++
Starter code:
template
struct node {
S fullName;
T workExperience;
string gender;
shared_ptr
shared_ptr
int height;
node(T w, S n, C g) {
this->fullName = n;
this->workExperience = w;
this->gender = g;
left = NULL;
right = NULL;
height = 1;
}
};
// AVL Class (This will be used for both BST and AVL Tree implementation)
template
class AVL {
shared_ptr
bool isAVL;
public:
AVL(bool);
void insertNode(shared_ptr
void deleteNode(T k);
shared_ptr
shared_ptr
int height (shared_ptr
};
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
