AppliedGo / comments

Utteranc.es comments for appliedgo.net
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

balancedtree #4

Open christophberger opened 1 year ago

christophberger commented 1 year ago

Written on 02/25/2017 13:48:08

URL: https://appliedgo.net/balancedtree/

christophberger commented 1 year ago

Migrated comment, written by 2705holbertonschool on 07/20/2021 19:32:17

Hello, thank you for the article.
You have typos under:
How to keep a tree in balance> Step 1. Detecting an imbalance>
"each subtee and each subtree’s subree"

christophberger commented 1 year ago

Migrated comment, written by alexander bikk on 10/19/2021 18:22:43

Hi, thanks for such well-structured and well-implemented article.

I think I found an unnecessary height calculation for rotateLeftRight and rotateRightLeft functions. We don't need to calculate the height of the node there.
When we call rotateLeftRight for example we do rotateLeft and update height for node.Left and node.Left.Right. Then we do rotateRight and update height for node and node.Left(old node.Left.Right). So finally height for each rotated node will be updated.

What do you think?