zig : upgrade codes && rust : add codes for chapter_searching and chapter_dynamic_programming. (#591)

* zig : update zig codes

* rust : add codes for linear_search and hashing_search

* rust : add codes for linear_search and hashing_search

* rust : add codes for chapter_dynamic_programming
This commit is contained in:
sjinzh
2023-07-10 01:32:12 +08:00
committed by GitHub
parent 6c133d42d5
commit 459449d41a
21 changed files with 485 additions and 187 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ pub fn AVLTree(comptime T: type) type {
// 更新节点高度
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;
}
// 获取平衡因子