i use this function to destroy my tree:
Code:
void DestroyTree(splay_t *root)
{
splay_t *tmp;
while(root)
{
while(root->left)
RotateRight(&root);
tmp = root;
root = root->right;
free(tmp->rec);
free(tmp);
}
}
when i compile this with djgpp and fill my tree with 1000000 random numbers it takes forever to free everything. if i remove one of the calls to free or if the data is entered sorted, it frees everything up pretty quick. i don't get this slow down with msvc. can anyone here explain what causes this or give a possible solution? thanks.