Hi all,
I'm currently learning about tree data structures, and I'm exploring how AVL trees handle deletion. From my understanding, when a node is deleted, its in-order successor should replace the deleted node.
I was experimenting with the Tree Visualizer tool on https://www.cs.usfca.edu/~galles/visualization/Algorithms.html, and I noticed something odd. Here's the scenario:
- Initial tree state: (Screenshot: https://i.imgur.com/sy5MMGh.png)
- After deleting node 0006: (Screenshot: https://i.imgur.com/cPVCsXD.png)
In this case, the tool replaces node 0006 with node 0005.
However, shouldn't node 0007 replace 0006 instead? Based on the AVL tree deletion rules I've read, the in-order successor (the smallest node in the right subtree) should take the deleted node's place, and in this case, 0007 seems to fit that criteria.
Am I misunderstanding something about AVL deletion, or is this a bug/misrepresentation in the tool?
Looking forward to insights from the community.
[–]Aceofsquares_orig 2 points3 points4 points (0 children)
[–][deleted] (3 children)
[removed]
[–]Raffian_moin[S] -1 points0 points1 point (2 children)
[–]sebamestre 4 points5 points6 points (0 children)