From a575259cac2ff3d7a87828d840e4a6fb4f107e1b Mon Sep 17 00:00:00 2001 From: Hofmann Jonas Date: Sat, 13 Dec 2025 15:09:35 +0100 Subject: [PATCH] removed not needed comments --- bintree.c | 58 ++++--------------------------------------------------- 1 file changed, 4 insertions(+), 54 deletions(-) diff --git a/bintree.c b/bintree.c index 4ff65ad..2d895ec 100644 --- a/bintree.c +++ b/bintree.c @@ -48,60 +48,10 @@ TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFc return addToTreeRec(root, newNode, compareFct, isDuplicate, 1); } -/* -TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType compareFct, int *isDuplicate, const int root) -{ - /*if ((currentNode == NULL)) - { - if ((isDuplicate == NULL) || root) - { - return newNode; - } - else - { - return currentNode; - } - } - - - -// Mögliche Ergänzung -------------------------- -if (currentNode == NULL) -{ - if (isDuplicate != NULL) - *isDuplicate = 0; - - return newNode; -} -//-------------------------------- - - else if ((compareFct(currentNode->data, newNode->data) < 0)) - { - currentNode->left = addToTreeRec(currentNode->left, newNode, compareFct, isDuplicate, 0); - } - else if ((compareFct(currentNode->data, newNode->data) > 0)) - { - currentNode->right = addToTreeRec(currentNode->right, newNode, compareFct, isDuplicate, 0); - } - else if ((compareFct(currentNode->data, newNode->data) == 0)) - { - if (isDuplicate == NULL) - { - currentNode->left = addToTreeRec(currentNode->left, newNode, compareFct, isDuplicate, 0); - } - else - { - *isDuplicate = 1; - } - } - - - return currentNode; -} */ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType compareFct, int *isDuplicate, const int root) { - if ((currentNode == NULL)) + if (currentNode == NULL) { if ((isDuplicate == NULL) || root) { @@ -118,15 +68,15 @@ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType return currentNode; } } - else if ((compareFct(currentNode->data, newNode->data) < 0)) + else if (compareFct(currentNode->data, newNode->data) < 0) { currentNode->left = addToTreeRec(currentNode->left, newNode, compareFct, isDuplicate, 0); } - else if ((compareFct(currentNode->data, newNode->data) > 0)) + else if (compareFct(currentNode->data, newNode->data) > 0) { currentNode->right = addToTreeRec(currentNode->right, newNode, compareFct, isDuplicate, 0); } - else if ((compareFct(currentNode->data, newNode->data) == 0)) + else if (compareFct(currentNode->data, newNode->data) == 0) { if (isDuplicate == NULL) {