mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-14 06:52:59 +08:00
Merge 6800c9aac9
into ca3d16dcce
This commit is contained in:
commit
3221ec5b0d
@ -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