Fix code naming style.

This commit is contained in:
krahets
2023-10-15 21:18:09 +08:00
parent ada37fd1f8
commit 346c8451de
23 changed files with 51 additions and 51 deletions
+5 -5
View File
@@ -102,7 +102,7 @@ void insert(binarySearchTree *bst, int num) {
/* 删除节点 */
// 由于引入了 stdio.h ,此处无法使用 remove 关键词
void removeNode(binarySearchTree *bst, int num) {
void removeItem(binarySearchTree *bst, int num) {
// 若树为空,直接提前返回
if (bst->root == NULL)
return;
@@ -144,7 +144,7 @@ void removeNode(binarySearchTree *bst, int num) {
}
int tmpVal = tmp->val;
// 递归删除节点 tmp
removeNode(bst, tmp->val);
removeItem(bst, tmp->val);
// 用 tmp 覆盖 cur
cur->val = tmpVal;
}
@@ -168,13 +168,13 @@ int main() {
printTree(getRoot(bst));
/* 删除节点 */
removeNode(bst, 1);
removeItem(bst, 1);
printf("删除节点 1 后,二叉树为\n");
printTree(getRoot(bst));
removeNode(bst, 2);
removeItem(bst, 2);
printf("删除节点 2 后,二叉树为\n");
printTree(getRoot(bst));
removeNode(bst, 4);
removeItem(bst, 4);
printf("删除节点 4 后,二叉树为\n");
printTree(getRoot(bst));