mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-10 11:09:43 +08:00
Compare commits
2 Commits
3221ec5b0d
...
ee6299dad1
Author | SHA1 | Date | |
---|---|---|---|
|
ee6299dad1 | ||
|
6800c9aac9 |
@ -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