mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
Update 二叉树理论基础.md
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user