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
#[derive(Debug, PartialEq, Eq)]
pub struct TreeNode {
pub val: i32,
pub left: Option<Rc<RefCell<TreeNode>>>,
pub right: Option<Rc<RefCell<TreeNode>>>,
pub struct TreeNode<T> {
pub val: T,
pub left: Option<Rc<RefCell<TreeNode<T>>>>,
pub right: Option<Rc<RefCell<TreeNode<T>>>>,
}
impl TreeNode {
impl<T> TreeNode<T> {
#[inline]
pub fn new(val: i32) -> Self {
pub fn new(val: T) -> Self {
TreeNode {
val,
left: None,