For an AVL tree, when deleting a node from the tree that requires restructuring, the book i am reading states that there are certain rules to following to select which nodes to restructure. An example is as such:
44
/ \
17 62
/ \
50 78
/ \ \
48 54 88
This is the AVL tree after a node(child of node 17) has been deleted and the height-balance property has been violated.
The book i read states that it will let z be the first unbalanced position encountered going up from node 17, y be the child of z with the greater height and finally x be the child of y with the greater height. However, if the children of y both have the same height, then x will be the same side as y. In this case, x is 78, y is 62, z is 44.
Now here is the question posed. Why do we select x such that it is the same side as y? Will there be any issues with the AVL tree if i select x to not be the same side as y? I have tried to give myself examples and tried selecting both types of x and, restructure the AVL tree. However, i cannot seem to find any issues that will arise from selecting x as either child. Any help is appreciated to help me solve this.