Ok, so I have an assignment to modify a previous assignment (binary tree) to now include balancing at each node. I understand what balancing is as far as if right side minus left side equals balancing factor of that node, and if the balancing factor of the node is < -1 and > 1 one or two rotations need to take place. But I'm not sure how to implement it. Any insight is much appreciated!
int rHeight; //you need to initialise the variable
while ( temp -> right != NULL)
{
rHeight ++;
temp = temp->right; //only to the rigth. Is that correct?
}