This commit is contained in:
krahets
2024-03-18 03:11:07 +08:00
parent bc0054a577
commit 54c7448946
48 changed files with 577 additions and 408 deletions
+2
View File
@@ -1819,6 +1819,7 @@ AVL 树的节点插入操作与二叉搜索树在主体上类似。唯一的区
}
}
Self::update_height(Some(node.clone())); // 更新节点高度
/* 2. 执行旋转操作,使该子树重新恢复平衡 */
node = Self::rotate(Some(node)).unwrap();
// 返回子树的根节点
@@ -2343,6 +2344,7 @@ AVL 树的节点插入操作与二叉搜索树在主体上类似。唯一的区
node.borrow_mut().val = temp.borrow().val;
}
Self::update_height(Some(node.clone())); // 更新节点高度
/* 2. 执行旋转操作,使该子树重新恢复平衡 */
node = Self::rotate(Some(node)).unwrap();
// 返回子树的根节点