mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-10 11:09:43 +08:00
Merge 6800c9aac9
into ca3d16dcce
This commit is contained in:
commit
3221ec5b0d
@ -26,7 +26,7 @@ export default class BinaryTreeNode {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.left.height + 1;
|
||||
return this.left.height;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -37,14 +37,14 @@ export default class BinaryTreeNode {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.right.height + 1;
|
||||
return this.right.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
get height() {
|
||||
return Math.max(this.leftHeight, this.rightHeight);
|
||||
return Math.max(this.leftHeight, this.rightHeight) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user