Fix binary tree node.

This commit is contained in:
Oleksii Trekhleb
2018-04-06 07:01:16 +03:00
parent 30c080ba02
commit 9eefd13615
2 changed files with 24 additions and 2 deletions

View File

@@ -32,13 +32,17 @@ export default class BinaryTreeNode {
setLeft(node) {
this.left = node;
this.left.parent = this;
if (node) {
this.left.parent = this;
}
return this;
}
setRight(node) {
this.right = node;
this.right.parent = this;
if (node) {
this.right.parent = this;
}
return this;
}