5 Commits
6 changed files with 12 additions and 2 deletions
+12 -2
View File
@@ -12,7 +12,6 @@
* `nextTreeData`: Traversierung mit Hilfe des zuvor implementierten Stacks. Done */ * `nextTreeData`: Traversierung mit Hilfe des zuvor implementierten Stacks. Done */
static TreeNode *root = NULL;
static StackNode *stackRoot = NULL; static StackNode *stackRoot = NULL;
@@ -56,10 +55,16 @@ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType
{ {
if ((isDuplicate == NULL) || root) if ((isDuplicate == NULL) || root)
{ {
if (isDuplicate != NULL)
{
*isDuplicate = 0;
}
return newNode; return newNode;
} }
else else
{ {
*isDuplicate = 0;
return currentNode; return currentNode;
} }
} }
@@ -83,7 +88,10 @@ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType
} }
} }
if (isDuplicate != NULL)
{
*isDuplicate = 0;
}
return currentNode; return currentNode;
} }
@@ -185,5 +193,7 @@ int treeSizeRec(const TreeNode *currentNode)
nodeCount += treeSizeRec(currentNode->right); nodeCount += treeSizeRec(currentNode->right);
return nodeCount + 1; return nodeCount + 1;
} }
return nodeCount;
} }
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.