I am developing an academic project about graph and tree theory.I searched a lot but I didn't find a clear answer. In a part of project we want to delete some nodes from tree for example we want to delete nodes A and B.I want to know that if we Delete A and then B does It give us exactly the same tree that We will produce when We Delete B and then A and if yes is there any proof or anything that can make sure us about that.
Tell me more
×
Mathematics Stack Exchange is a question and answer site for
people studying math at any level and professionals in related fields. It's 100% free, no registration required.
|
|
finally i will find the answer! Deletion (in general) is not commutative. Here is a counterexample:
What if we delete 4 and then 3? When we delete 4, we get 6 as the new root:
Deleting 3 doesn't change the tree, but gives us this:
What if we delete 3 and then 4? When we delete 3 the tree doesn't change:
However, when we now delete 4, the new root becomes 7:
The two resulting trees are not the same, therefore deletion is not commutative. reference and more details : http://stackoverflow.com/questions/2990486/deletion-procedure-for-a-binary-search-tree |
|||
|
|
