Fix binary tree node.

This commit is contained in:
Oleksii Trekhleb
2018-04-05 15:54:25 +03:00
parent d19149de8e
commit 30c080ba02
2 changed files with 9 additions and 0 deletions

View File

@@ -26,6 +26,10 @@ export default class BinaryTreeNode {
return Math.max(this.leftHeight, this.rightHeight);
}
get balanceFactor() {
return this.leftHeight - this.rightHeight;
}
setLeft(node) {
this.left = node;
this.left.parent = this;