Working with Graphs & Trees
What property of AVL trees is being calculated and maintained?
class AVLTree {
updateHeight(node) {
node.height = 1 + Math.max(
this.getHeight(node.left),
this.getHeight(node.right)
);
}
getBalance(node) {
return this.getHeight(node.left) -
this.getHeight(node.right);
}
}