mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2026-03-13 08:51:02 +08:00
Fix binary tree node.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user