From b3640c53d116222a5f09cc71f6393eceb06f2bb2 Mon Sep 17 00:00:00 2001 From: krahets Date: Fri, 14 Apr 2023 05:52:59 +0800 Subject: [PATCH] Remove unused functions. --- codes/c/chapter_tree/avl_tree.c | 12 ----------- .../java/chapter_tree/binary_search_tree.java | 11 ---------- docs/chapter_tree/avl_tree.md | 20 ------------------- docs/chapter_tree/binary_search_tree.md | 20 ------------------- 4 files changed, 63 deletions(-) diff --git a/codes/c/chapter_tree/avl_tree.c b/codes/c/chapter_tree/avl_tree.c index 3a148c3ac..9c30afcb2 100644 --- a/codes/c/chapter_tree/avl_tree.c +++ b/codes/c/chapter_tree/avl_tree.c @@ -137,18 +137,6 @@ void insert(avlTree *tree, int val) { tree->root = insertHelper(tree->root, val); } -/* 获取中序遍历中的下一个节点(仅适用于 root 有左子节点的情况) */ -TreeNode *getInOrderNext(TreeNode *node) { - if (node == NULL) { - return node; - } - // 循环访问左子节点,直到叶节点时为最小节点,跳出 - while (node->left != NULL) { - node = node->left; - } - return node; -} - /* 递归删除节点(辅助方法) */ TreeNode *removeHelper(TreeNode *node, int val) { TreeNode *child, *grandChild; diff --git a/codes/java/chapter_tree/binary_search_tree.java b/codes/java/chapter_tree/binary_search_tree.java index 8565b7be5..1806c0ca7 100644 --- a/codes/java/chapter_tree/binary_search_tree.java +++ b/codes/java/chapter_tree/binary_search_tree.java @@ -127,17 +127,6 @@ class BinarySearchTree { cur.val = tmp.val; } } - - /* 获取中序遍历中的下一个节点(仅适用于 root 有左子节点的情况) */ - public TreeNode getInOrderNext(TreeNode root) { - if (root == null) - return root; - // 循环访问左子节点,直到叶节点时为最小节点,跳出 - while (root.left != null) { - root = root.left; - } - return root; - } } public class binary_search_tree { diff --git a/docs/chapter_tree/avl_tree.md b/docs/chapter_tree/avl_tree.md index 134a16084..e8e7adf49 100644 --- a/docs/chapter_tree/avl_tree.md +++ b/docs/chapter_tree/avl_tree.md @@ -646,8 +646,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{AVLTree}-[func]{remove} [class]{AVLTree}-[func]{removeHelper} - - [class]{AVLTree}-[func]{getInOrderNext} ``` === "C++" @@ -656,8 +654,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{AVLTree}-[func]{remove} [class]{AVLTree}-[func]{removeHelper} - - [class]{AVLTree}-[func]{getInOrderNext} ``` === "Python" @@ -666,8 +662,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{AVLTree}-[func]{remove} [class]{AVLTree}-[func]{__remove_helper} - - [class]{AVLTree}-[func]{__get_inorder_next} ``` === "Go" @@ -676,8 +670,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{aVLTree}-[func]{remove} [class]{aVLTree}-[func]{removeHelper} - - [class]{aVLTree}-[func]{getInOrderNext} ``` === "JavaScript" @@ -686,8 +678,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{AVLTree}-[func]{remove} [class]{AVLTree}-[func]{#removeHelper} - - [class]{AVLTree}-[func]{#getInOrderNext} ``` === "TypeScript" @@ -696,8 +686,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{AVLTree}-[func]{remove} [class]{AVLTree}-[func]{removeHelper} - - [class]{AVLTree}-[func]{getInOrderNext} ``` === "C" @@ -706,8 +694,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{aVLTree}-[func]{remove} [class]{aVLTree}-[func]{removeHelper} - - [class]{aVLTree}-[func]{getInOrderNext} ``` === "C#" @@ -716,8 +702,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{AVLTree}-[func]{remove} [class]{AVLTree}-[func]{removeHelper} - - [class]{AVLTree}-[func]{getInOrderNext} ``` === "Swift" @@ -726,8 +710,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{AVLTree}-[func]{remove} [class]{AVLTree}-[func]{removeHelper} - - [class]{AVLTree}-[func]{getInOrderNext} ``` === "Zig" @@ -736,8 +718,6 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉 [class]{AVLTree}-[func]{remove} [class]{AVLTree}-[func]{removeHelper} - - [class]{AVLTree}-[func]{getInOrderNext} ``` ### 查找节点 diff --git a/docs/chapter_tree/binary_search_tree.md b/docs/chapter_tree/binary_search_tree.md index affe026ac..dd38bdf6c 100755 --- a/docs/chapter_tree/binary_search_tree.md +++ b/docs/chapter_tree/binary_search_tree.md @@ -202,80 +202,60 @@ ```java title="binary_search_tree.java" [class]{BinarySearchTree}-[func]{remove} - - [class]{BinarySearchTree}-[func]{getInOrderNext} ``` === "C++" ```cpp title="binary_search_tree.cpp" [class]{BinarySearchTree}-[func]{remove} - - [class]{BinarySearchTree}-[func]{getInOrderNext} ``` === "Python" ```python title="binary_search_tree.py" [class]{BinarySearchTree}-[func]{remove} - - [class]{BinarySearchTree}-[func]{get_inorder_next} ``` === "Go" ```go title="binary_search_tree.go" [class]{binarySearchTree}-[func]{remove} - - [class]{binarySearchTree}-[func]{getInOrderNext} ``` === "JavaScript" ```javascript title="binary_search_tree.js" [class]{}-[func]{remove} - - [class]{}-[func]{getInOrderNext} ``` === "TypeScript" ```typescript title="binary_search_tree.ts" [class]{}-[func]{remove} - - [class]{}-[func]{getInOrderNext} ``` === "C" ```c title="binary_search_tree.c" [class]{binarySearchTree}-[func]{remove} - - [class]{binarySearchTree}-[func]{getInOrderNext} ``` === "C#" ```csharp title="binary_search_tree.cs" [class]{BinarySearchTree}-[func]{remove} - - [class]{BinarySearchTree}-[func]{getInOrderNext} ``` === "Swift" ```swift title="binary_search_tree.swift" [class]{BinarySearchTree}-[func]{remove} - - [class]{BinarySearchTree}-[func]{getInOrderNext} ``` === "Zig" ```zig title="binary_search_tree.zig" [class]{BinarySearchTree}-[func]{remove} - - [class]{BinarySearchTree}-[func]{getInOrderNext} ``` ### 排序