Compare commits
9
Commits
8e76b27760
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a7a939fc4 | ||
|
|
44d96647bb | ||
|
|
8605da95b6 | ||
|
|
a3e12875aa | ||
|
|
b7fa24f2e9 | ||
|
|
b69cfb0640 | ||
|
|
686fe8d844 | ||
|
|
c37ce6327c | ||
|
|
111b9c5532 |
Binary file not shown.
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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
Binary file not shown.
@@ -1,3 +1 @@
|
|||||||
àoï;0
|
|
||||||
test;9238
|
|
||||||
player1;3999
|
player1;3999
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user