Hello all, I would once again like to ask for advice. I've created a binary tree that adds and deletes random elements. I read in my Data Structures text, regarding the below deleteByCopying() function, which can lead to an unbalanced tree, that:

'a simple improvement can make the algorightm symmetrical. The algorithm can alternately delete the predecessor of the key in node from the left subtree and delete its successor form the right subtree.'

What does this mean in regards to:

I can't figure out why it's talking about deleting predecessors and successors. The sucessor from the right subtree sounds like node->right, the right subchild, but: successor from the left subtree? Successor sounds like it's parent, prev, and not like node->left. Can anyone help?Code:template<class T> void deleteByCopying(BinSearchNode<T>*& node) { BinSearchNode<T> *previous, *tmp = node; if(node->right == 0) node = node->left; else if(node->left == 0) node = node->right; else { tmp = node->left; previous = node; while(tmp->right != 0) { previous = tmp; tmp = tmp->right; } node->key = tmp->key; if(previous == node) previous->left = tmp->left; else previous->right = tmp->left; } delete tmp; }

Thanks,

-Patrick