The imbalance can be removed by carefully rearranging the nodes of the tree. For instance, the zone of
imbalance in the tree is the left subtree with root node 30 (say Node P). Within this subtree, the imbalance
is in right subtree with root node 46 (say Node Q). The closest node to the inserted node is 57. Call this
node as R. A point worth noting is that P, Q, and R are numbers and can be rearranged as per binary search
rule, i.e., the smallest becomes the left child, the largest as the right child and the middle one becomes the
root. This rearrangement can eliminate the imbalance in the section as shown in Figur ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.