Closed HardMax71 closed 3 years ago
The algorithm seems to switch 17 with 24 instead of the correct 12. Because of that, the balance difference is 2/-1. After the l/r rotation is carried out, the tree is correct again.
Technically, there was nothing wrong and it was a simple issue of which node to replace the deleted node with if it has two children. Since GAD standardizes it to be the predecessor, our implementation is wrong and this will be fixed after some more testing.
This would also mean that the arrival at that position was incorrect since delete(16) should have resulted in 16 being replaced by 12 (predecessor). This is also the way it works in the simulator by David Galles (USFCA).
Side note: It's 2:30 am and I have no idea why I just did this for 30 minutes instead of going to sleep
Describe the bug The type of rotation after specific action in solutions.pdf is false, although the tree is correct.
To Reproduce
Expected behavior "No rotation" is expected.
Screenshots Task itself :![image](https://user-images.githubusercontent.com/66359507/95022959-eefceb80-0682-11eb-909c-702ae51dcdae.png)
AVL-Tree before delete(17) :![image](https://user-images.githubusercontent.com/66359507/95022920-ab09e680-0682-11eb-85ac-7fc0d50d04c5.png)
Solution (after delete(17)) in solutions.pdf :![image](https://user-images.githubusercontent.com/66359507/95022946-d42a7700-0682-11eb-847c-bb38397f8292.png)
Solution path (used https://www.cs.usfca.edu/~galles/visualization/AVLtree.html) : https://gyazo.com/e05859c74b19c312d042c142966c4fb8
Desktop (please complete the following information):
Additional context Add any other context about the problem here.