mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 15:53:02 +08:00
Compare commits
2 Commits
3221ec5b0d
...
ee6299dad1
Author | SHA1 | Date | |
---|---|---|---|
|
ee6299dad1 | ||
|
6800c9aac9 |
@ -26,7 +26,7 @@ export default class BinaryTreeNode {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.left.height + 1;
|
return this.left.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,14 +37,14 @@ export default class BinaryTreeNode {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.right.height + 1;
|
return this.right.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
get height() {
|
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