feat: add rust codes for chapter computational complexity (#714)

This commit is contained in:
Night Cruising
2023-09-02 16:08:52 +08:00
committed by GitHub
parent 8a0a8b80cf
commit 3af00d00d7
4 changed files with 139 additions and 1 deletions

View File

@@ -76,7 +76,7 @@ impl BinarySearchTree {
pub fn insert(&mut self, num: i32) {
// 若树为空,则初始化根节点
if self.root.is_none() {
self.root = TreeNode::new(num);
self.root = Some(TreeNode::new(num));
return;
}
let mut cur = self.root.clone();