Update 二叉树理论基础.md

This commit is contained in:
fw_qaq
2022-11-05 14:36:15 +08:00
committed by GitHub
parent 7803388377
commit 72b6043daa

View File

@ -275,15 +275,15 @@ rust:
```rust ```rust
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub struct TreeNode { pub struct TreeNode<T> {
pub val: i32, pub val: T,
pub left: Option<Rc<RefCell<TreeNode>>>, pub left: Option<Rc<RefCell<TreeNode<T>>>>,
pub right: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode<T>>>>,
} }
impl TreeNode { impl<T> TreeNode<T> {
#[inline] #[inline]
pub fn new(val: i32) -> Self { pub fn new(val: T) -> Self {
TreeNode { TreeNode {
val, val,
left: None, left: None,