Final fix of doble numbers

This commit is contained in:
Thilo 2025-12-16 12:01:53 +01:00
parent 4b81d627f5
commit bbf0460d1a
3 changed files with 32 additions and 1 deletions

View File

@ -1,3 +1,9 @@
thilo;19753
thilo;14880
thilo;14733
player1;9956
player2;4988
player1;4980
player_name;4980
player2;4885
player1;3999

View File

@ -73,11 +73,36 @@ unsigned int *createNumbers(unsigned int len)
srand(time(NULL));
for (unsigned int i = 0; i < len; i++)
/*for (unsigned int i = 0; i < len; i++)
{
array[i] = rand() % (2*len) + 1;
}
*/
TreeNode *root = NULL;
int isDuplicate;
unsigned int value;
unsigned int i = 0;
srand(time(NULL));
while (i < len)
{
value = rand() % (2 * len) + 1;
root = addToTree(root, &value, sizeof(unsigned int), compareFct, &isDuplicate);
if (isDuplicate == 0)
{
array[i] = value;
i++;
}
// Bei Duplikat: nochmal versuchen, kein Inkrement
}
clearTree(root);
position = rand() % len;

BIN
stack.o

Binary file not shown.