9 Commits
14 changed files with 8 additions and 12 deletions
Binary file not shown.
+3 -6
View File
@@ -88,10 +88,7 @@ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType
} }
} }
if (isDuplicate != NULL)
{
*isDuplicate = 0;
}
return currentNode; return currentNode;
} }
@@ -110,13 +107,13 @@ void *nextTreeData(TreeNode *root)
{ {
// Add tree to stack so that bigest entry is ontop // Add tree to stack so that bigest entry is ontop
stackRoot = nextTreeDataRec(root, stackRoot); stackRoot = nextTreeDataRec(root, stackRoot);
pointerToReturn = stackRoot; pointerToReturn = top(stackRoot);
} }
else else
{ {
// return current top entry and then pop that top entry // return current top entry and then pop that top entry
pointerToReturn = top(stackRoot);
stackRoot = pop(stackRoot); stackRoot = pop(stackRoot);
pointerToReturn = top(stackRoot);
} }
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -115,7 +115,7 @@ void test_nextTreeDataReturnsNextDataCorrectly(void)
// check if nextTreeData returns Data correctly // check if nextTreeData returns Data correctly
TEST_ASSERT_NOT_NULL(entry); TEST_ASSERT_NOT_NULL(entry);
TEST_ASSERT_EQUAL(score7, *(int *)nextTreeData(NULL)); TEST_ASSERT_EQUAL(score7, *(int *)entry);
TEST_ASSERT_EQUAL(score3, *(int *)nextTreeData(NULL)); TEST_ASSERT_EQUAL(score3, *(int *)nextTreeData(NULL));
TEST_ASSERT_EQUAL(score6, *(int *)nextTreeData(NULL)); TEST_ASSERT_EQUAL(score6, *(int *)nextTreeData(NULL));
TEST_ASSERT_EQUAL(score1, *(int *)nextTreeData(NULL)); TEST_ASSERT_EQUAL(score1, *(int *)nextTreeData(NULL));
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
-2
View File
@@ -1,3 +1 @@
àoï;0
test;9238
player1;3999 player1;3999
BIN
View File
Binary file not shown.
+4 -3
View File
@@ -31,13 +31,14 @@ static int existsInTree(TreeNode *root, unsigned int value)
unsigned int *data; unsigned int *data;
// Traversierung initialisieren // Traversierung initialisieren
nextTreeData(root); data = nextTreeData(root);
while ((data = nextTreeData(NULL)) != NULL) do
{ {
if (*data == value) if (*data == value)
return 1; return 1;
} } while ((data = nextTreeData(NULL)) != NULL);
return 0; return 0;
} }
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.