This commit is contained in:
krahets
2024-07-30 16:54:41 +08:00
parent f9d935e34c
commit 03a6cd27ca
31 changed files with 94 additions and 92 deletions
+4 -4
View File
@@ -61,7 +61,7 @@ A <u>binary tree</u> is a non-linear data structure that represents the hierarch
Left *TreeNode
Right *TreeNode
}
/* 构造方法 */
/* Constructor */
func NewTreeNode(v int) *TreeNode {
return &TreeNode{
Left: nil, // Pointer to left child node
@@ -145,7 +145,7 @@ A <u>binary tree</u> is a non-linear data structure that represents the hierarch
}
impl TreeNode {
/* 构造方法 */
/* Constructor */
fn new(val: i32) -> Rc<RefCell<Self>> {
Rc::new(RefCell::new(Self {
val,
@@ -162,12 +162,12 @@ A <u>binary tree</u> is a non-linear data structure that represents the hierarch
/* Binary tree node */
typedef struct TreeNode {
int val; // Node value
int height; // 节点高度
int height; // Node height
struct TreeNode *left; // Pointer to left child node
struct TreeNode *right; // Pointer to right child node
} TreeNode;
/* 构造函数 */
/* Constructor */
TreeNode *newTreeNode(int val) {
TreeNode *node;