diff --git a/bintree.c b/bintree.c index d5d86ca..7164681 100644 --- a/bintree.c +++ b/bintree.c @@ -2,8 +2,7 @@ #include "stack.h" #include "bintree.h" -// Adds a copy of data's pointer destination to the tree using compareFct for ordering. Accepts duplicates -// if isDuplicate is NULL, otherwise ignores duplicates and sets isDuplicate to 1 (or to 0 if a new entry is added). +//fügt einen kopierten Datensatz in einen binären Suchbaum ein und meldet optional Duplikate. TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFctType compareFct, int *isDuplicate) { if (root == NULL) @@ -49,6 +48,8 @@ TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFc // 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. // Use your implementation of a stack to organize the iterator. Push the root node and all left nodes first. On returning the next element, // push the top node and push all its left nodes. + +//liefert nacheinander die Elemente in aufsteigender Reihenfolge (Inorder) und merkt sich den Zustand zwischen Aufrufen mit einem Stack. void *nextTreeData(TreeNode *root) { /* static iterator state using stack.c */ @@ -104,7 +105,7 @@ void *nextTreeData(TreeNode *root) return result; } -// Releases all memory resources (including data copies). +// Gibnt alle Knoten und ihre daten frei. void clearTree(TreeNode *root) { if (root == NULL) @@ -119,7 +120,7 @@ void clearTree(TreeNode *root) free(root); } -// Returns the number of entries in the tree given by root. +// Zählt rekursiv die anzahl an knoten ab *root. unsigned int treeSize(const TreeNode *root) { if (root == NULL) diff --git a/highscores.txt b/highscores.txt index 2fde905..4edd5a7 100644 --- a/highscores.txt +++ b/highscores.txt @@ -1,10 +1 @@ -player_name;19803 -player;19540 -player_name;19102 -player_test2;9976 -player_test;9967 -player;9960 -player_name;9960 -player_name;9953 -miguel;9935 -player;9920 +player1;3999