mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-16 03:59:18 +08:00
Several bug fixes.
This commit is contained in:
@@ -475,7 +475,6 @@ $$
|
||||
node.borrow().val.hash(&mut hasher);
|
||||
let hash = hasher.finish();
|
||||
// 节点对象 RefCell { value: ListNode { val: 42, next: None } } 的哈希值为15387811073369036852
|
||||
|
||||
```
|
||||
|
||||
=== "C"
|
||||
|
||||
@@ -156,7 +156,7 @@ AVL 树既是二叉搜索树也是平衡二叉树,同时满足这两类二叉
|
||||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
|
||||
/* AVL 树节点类型 */
|
||||
/* AVL 树节点结构体 */
|
||||
struct TreeNode {
|
||||
val: i32, // 节点值
|
||||
height: i32, // 节点高度
|
||||
@@ -165,7 +165,7 @@ AVL 树既是二叉搜索树也是平衡二叉树,同时满足这两类二叉
|
||||
}
|
||||
|
||||
impl TreeNode {
|
||||
/* AVL 树节点构造方法 */
|
||||
/* 构造方法 */
|
||||
fn new(val: i32) -> Rc<RefCell<Self>> {
|
||||
Rc::new(RefCell::new(Self {
|
||||
val,
|
||||
|
||||
Reference in New Issue
Block a user