Compare commits

...

1 Commits
temp ... main

Author SHA1 Message Date
Simon May
804294b96e aufräumen 2025-12-02 14:44:04 +01:00
3 changed files with 36 additions and 5 deletions

View File

@ -13,6 +13,7 @@
TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFctType compareFct, int *isDuplicate)
{
}
// Iterates over the tree given by root. Follows the usage of strtok. If tree is NULL, the next entry of the last tree given is returned in ordering direction.
@ -26,11 +27,36 @@ void *nextTreeData(TreeNode *root)
// Releases all memory resources (including data copies).
void clearTree(TreeNode *root)
{
if (root == NULL)
{
return;
}
if (root->left != NULL)
{
clearTree(root->left);
free(root->left);
}
else if (root->right != NULL)
{
clearTree(root->right);
free(root->right);
}
root->data = NULL;
}
// Returns the number of entries in the tree given by root.
unsigned int treeSize(const TreeNode *root)
{
int counterL, counterR = 0;
if (root->left != NULL)
{
counterL = treeSize(root->left) + 1;
}
else if (root->right != NULL)
{
counterR = treeSize(root->right) + 1;
}
return counterL + counterR;
}

View File

@ -136,6 +136,11 @@ unsigned int getDuplicate(const unsigned int numbers[], unsigned int len)
unsigned int temp[len];
unsigned int duplicate = 0;
/*if(numbers == NULL || (sizeof(numbers) / sizeof(typeof(numbers)) != len))
{
return 0;S
}*/
for (int i = 0; i < len; i++)
{
temp[i] = numbers[i];

Binary file not shown.