diff --git a/codes/c/chapter_tree/binary_search_tree.c b/codes/c/chapter_tree/binary_search_tree.c index 7e7da8dd6..d72779e3b 100644 --- a/codes/c/chapter_tree/binary_search_tree.c +++ b/codes/c/chapter_tree/binary_search_tree.c @@ -89,7 +89,7 @@ void insert(binarySearchTree *bst, int num) { cur = cur->left; } } - // 插入节点 val + // 插入节点 TreeNode *node = newTreeNode(num); if (pre->val < num) { pre->right = node; diff --git a/codes/cpp/chapter_tree/binary_search_tree.cpp b/codes/cpp/chapter_tree/binary_search_tree.cpp index 8b8e83bfa..3df23fc3f 100644 --- a/codes/cpp/chapter_tree/binary_search_tree.cpp +++ b/codes/cpp/chapter_tree/binary_search_tree.cpp @@ -77,7 +77,7 @@ class BinarySearchTree { else cur = cur->left; } - // 插入节点 val + // 插入节点 TreeNode *node = new TreeNode(num); if (pre->val < num) pre->right = node; diff --git a/codes/csharp/chapter_tree/binary_search_tree.cs b/codes/csharp/chapter_tree/binary_search_tree.cs index e85dfc4c4..577c26a18 100644 --- a/codes/csharp/chapter_tree/binary_search_tree.cs +++ b/codes/csharp/chapter_tree/binary_search_tree.cs @@ -63,7 +63,7 @@ class BinarySearchTree { else cur = cur.left; } - // 插入节点 val + // 插入节点 TreeNode node = new TreeNode(num); if (pre != null) { if (pre.val < num) pre.right = node; diff --git a/codes/dart/chapter_tree/binary_search_tree.dart b/codes/dart/chapter_tree/binary_search_tree.dart index 8ba6c2305..acc5c3e6d 100644 --- a/codes/dart/chapter_tree/binary_search_tree.dart +++ b/codes/dart/chapter_tree/binary_search_tree.dart @@ -70,7 +70,7 @@ void insert(int num) { else cur = cur.left; } - // 插入节点 val + // 插入节点 TreeNode? node = TreeNode(num); if (pre!.val < num) pre.right = node; diff --git a/codes/java/chapter_tree/binary_search_tree.java b/codes/java/chapter_tree/binary_search_tree.java index 056542294..314659668 100644 --- a/codes/java/chapter_tree/binary_search_tree.java +++ b/codes/java/chapter_tree/binary_search_tree.java @@ -74,7 +74,7 @@ class BinarySearchTree { else cur = cur.left; } - // 插入节点 val + // 插入节点 TreeNode node = new TreeNode(num); if (pre.val < num) pre.right = node; diff --git a/codes/javascript/chapter_tree/binary_search_tree.js b/codes/javascript/chapter_tree/binary_search_tree.js index 360169f93..a222d1f36 100644 --- a/codes/javascript/chapter_tree/binary_search_tree.js +++ b/codes/javascript/chapter_tree/binary_search_tree.js @@ -66,7 +66,7 @@ function insert(num) { // 插入位置在 cur 的左子树中 else cur = cur.left; } - // 插入节点 val + // 插入节点 let node = new TreeNode(num); if (pre.val < num) pre.right = node; else pre.left = node; diff --git a/codes/python/chapter_tree/binary_search_tree.py b/codes/python/chapter_tree/binary_search_tree.py index fc9b98ccf..fe50fb803 100644 --- a/codes/python/chapter_tree/binary_search_tree.py +++ b/codes/python/chapter_tree/binary_search_tree.py @@ -77,7 +77,7 @@ class BinarySearchTree: else: cur = cur.left - # 插入节点 val + # 插入节点 node = TreeNode(num) if pre.val < num: pre.right = node diff --git a/codes/swift/chapter_tree/binary_search_tree.swift b/codes/swift/chapter_tree/binary_search_tree.swift index d1596661a..874d0c509 100644 --- a/codes/swift/chapter_tree/binary_search_tree.swift +++ b/codes/swift/chapter_tree/binary_search_tree.swift @@ -80,7 +80,7 @@ class BinarySearchTree { cur = cur?.left } } - // 插入节点 val + // 插入节点 let node = TreeNode(x: num) if pre!.val < num { pre?.right = node diff --git a/codes/typescript/chapter_tree/binary_search_tree.ts b/codes/typescript/chapter_tree/binary_search_tree.ts index fa40a0ca1..d2fbf2de6 100644 --- a/codes/typescript/chapter_tree/binary_search_tree.ts +++ b/codes/typescript/chapter_tree/binary_search_tree.ts @@ -71,7 +71,7 @@ function insert(num: number): void { cur = cur.left as TreeNode; // 插入位置在 cur 的左子树中 } } - // 插入节点 val + // 插入节点 let node = new TreeNode(num); if (pre!.val < num) { pre!.right = node; diff --git a/codes/zig/chapter_tree/binary_search_tree.zig b/codes/zig/chapter_tree/binary_search_tree.zig index ca62cd695..5ce1aedd6 100644 --- a/codes/zig/chapter_tree/binary_search_tree.zig +++ b/codes/zig/chapter_tree/binary_search_tree.zig @@ -87,7 +87,7 @@ pub fn BinarySearchTree(comptime T: type) type { cur = cur.?.left; } } - // 插入节点 val + // 插入节点 var node = try self.mem_allocator.create(inc.TreeNode(T)); node.init(num); if (pre.?.val < num) {