williamfiset / Algorithms

A collection of algorithms and data structures
MIT License
17.29k stars 4.37k forks source link

Don't we have to update newParent.right.parent? #252

Closed Jinchul81 closed 3 years ago

Jinchul81 commented 3 years ago

https://github.com/williamfiset/Algorithms/blob/9750d76d494090f49d0a80e4db2d3dcd33d05775/src/main/java/com/williamfiset/algorithms/datastructures/balancedtree/AVLTreeRecursiveOptimized.java#L186

I guess the update newParent.right.parent seems to be missing. I think we need the following line should be necessary. Am I wrong? If I am wrong, would you please explain the reason? Thanks. if (newParent.right) newParent.right.parent = node;

Jinchul81 commented 3 years ago

I am sorry I thought Node contained its parent node. I confused with other materials. Let me close this issue.