/** * * Function used to delete a tree. Do not call directly. * */ static void deleteTreeRecursive(Node *x/*, int *sizeDb*/){ if (x->right != NIL) deleteTreeRecursive(x->right/*, sizeDb*/); if (x->left != NIL) deleteTreeRecursive(x->left/*, sizeDb*/); freeRBData(x->data/*, sizeDb*/); free(x); }
/** * * Function used to delete a tree. Do not call directly. * */ static void deleteTreeRecursive(Node *x, int *sizeDb) { if (x->right != NIL) deleteTreeRecursive(x->right, sizeDb); if (x->left != NIL) deleteTreeRecursive(x->left, sizeDb); freeRBData(x->data, sizeDb); free(x); }
static void deleteTreeRecursive(Node *x) { if (x->right != NIL) deleteTreeRecursive(x->right); if (x->left != NIL) deleteTreeRecursive(x->left); freeRBData(x->data); free(x); }
void deleteTree(RBTree *tree) { if (tree->root != NIL) deleteTreeRecursive(tree->root); }
/** * * Delete a tree. All the nodes and all the data pointed to by * the tree is deleted. * */ void deleteTree(RBTree *tree){ //int *ptr = &(tree->sizeDb); if (tree->root != NIL) deleteTreeRecursive(tree->root/*, ptr*/); }