Question: BSTY::BSTY() { root = NULL; } #include BSTY.hpp #include #include #include using namespace std; With this information please write this method in C++ // the

 BSTY::BSTY() { root = NULL; } #include "BSTY.hpp" #include #include #include

BSTY::BSTY() {

root = NULL;

}

#include "BSTY.hpp" #include #include #include using namespace std;

With this information please write this method in C++

// the adjustHeights method updates the heights of every ancestor of the node n // This method will be massively useful with our next lab, so make sure you have // this working now. It should be called whenever you change the height of a // a particular node. So, for instance, when a new node is inserted as a leaf, // its height is 1. The adjustHeights method should then check the parent to see // if the height of the parent changes (the height of each node is the maximum of // the height of the left child and the height of the right child, plus 1). If // the parent's height changes, then the grandparent's height should be checked and, // if necessary, adjusted. If the grandparent's height is updated, then the great- // grandparent's height should be adjusted, etc. The checking stops when either // the loop has worked its way up to the root, or until the currently being checked // ancestor is not changed. void BSTY: :adjustHeights (NodeT *n) {

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!