Finding height is a operation.

  • With as Golden Ratio
  • With as the height of the sub tree

Code

int height(AVL_Node* node) {  
  if (node == NULLreturn 0;  
  int left = height(node->left);  
  int right = height(node->right);  
  if (left > right) return left + 1;  
  return right + 1;  
}
 
void updateHeight(AVL_Node* node) { 
	node->height = height(node); 
}