Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45b6fab21a | ||
|
|
d1320cf6b7 | ||
|
|
369c019c30 | ||
|
|
cccc013b99 | ||
|
|
9a79ff0ad4 |
@@ -12,7 +12,6 @@
|
||||
* `nextTreeData`: Traversierung mit Hilfe des zuvor implementierten Stacks. Done */
|
||||
|
||||
|
||||
static TreeNode *root = NULL;
|
||||
static StackNode *stackRoot = NULL;
|
||||
|
||||
|
||||
@@ -56,10 +55,16 @@ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType
|
||||
{
|
||||
if ((isDuplicate == NULL) || root)
|
||||
{
|
||||
if (isDuplicate != NULL)
|
||||
{
|
||||
*isDuplicate = 0;
|
||||
}
|
||||
|
||||
return newNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
*isDuplicate = 0;
|
||||
return currentNode;
|
||||
}
|
||||
}
|
||||
@@ -83,7 +88,10 @@ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isDuplicate != NULL)
|
||||
{
|
||||
*isDuplicate = 0;
|
||||
}
|
||||
return currentNode;
|
||||
}
|
||||
|
||||
@@ -185,5 +193,7 @@ int treeSizeRec(const TreeNode *currentNode)
|
||||
nodeCount += treeSizeRec(currentNode->right);
|
||||
return nodeCount + 1;
|
||||
}
|
||||
|
||||
return nodeCount;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user