Bug fixes and improvements (#1572)

* Sync zh and zh-hant versions.

* Remove the polyfill.io link from mkdocs.yml

* Update contributors' info for code reviewers and en/zh-hant versions reviewers.

* Fix graph.md

* Update avatars for English version reviewers.

* Sync zh and zh-hant versions.

* Fix two_sum_brute_force.png

* Sync zh and zh-hant versions.
Optimize structrue of index.html.

* Format index.html
This commit is contained in:
Yudong Jin
2024-11-25 19:21:11 +08:00
committed by GitHub
parent 01a5f7b09f
commit 2a9db6d039
65 changed files with 414 additions and 140 deletions
@@ -4,13 +4,13 @@
* Author: xBLACKICEx (xBLACKICE@outlook.com)、night-cruise (2586447362@qq.com)
*/
include!("../include/include.rs");
use hello_algo_rust::include::print_util;
use std::cell::RefCell;
use std::cmp::Ordering;
use std::rc::Rc;
use tree_node::TreeNode;
use hello_algo_rust::include::TreeNode;
type OptionTreeNodeRc = Option<Rc<RefCell<TreeNode>>>;
@@ -126,7 +126,7 @@ impl BinarySearchTree {
// 刪除節點 cur
if !Rc::ptr_eq(&cur, self.root.as_ref().unwrap()) {
let left = pre.borrow().left.clone();
if left.is_some() && Rc::ptr_eq(&left.as_ref().unwrap(), &cur) {
if left.is_some() && Rc::ptr_eq(left.as_ref().unwrap(), &cur) {
pre.borrow_mut().left = child;
} else {
pre.borrow_mut().right = child;
@@ -147,11 +147,11 @@ impl BinarySearchTree {
break;
}
}
let tmpval = tmp.unwrap().borrow().val;
let tmp_val = tmp.unwrap().borrow().val;
// 遞迴刪除節點 tmp
self.remove(tmpval);
self.remove(tmp_val);
// 用 tmp 覆蓋 cur
cur.borrow_mut().val = tmpval;
cur.borrow_mut().val = tmp_val;
}
}
}