This commit is contained in:
krahets
2023-07-11 01:02:48 +08:00
parent b1544c92ca
commit cd145751e2
9 changed files with 449 additions and 48 deletions

View File

@@ -369,7 +369,7 @@ G. M. Adelson-Velsky 和 E. M. Landis 在其 1962 年发表的论文 "An algorit
// 更新节点高度
fn updateHeight(self: *Self, node: ?*inc.TreeNode(T)) void {
// 节点高度等于最高子树高度 + 1
node.?.height = std.math.max(self.height(node.?.left), self.height(node.?.right)) + 1;
node.?.height = @max(self.height(node.?.left), self.height(node.?.right)) + 1;
}
```