First of all, you can create a function that calculates the balance factor of each node (updateBalanceFactors) but that adds to the complexity of the addNode and deleteNode functions so I want to avoid it. When i am adding nodes to the tree, I found the way to update the balance factors without an updateBalaceFactors function. After the rotations i again found a way to update the balance factors correctly. I also want to mention that my struct node doesn't contain a height variable so I have not used the classic lheight - rheight to calculate the balance factors from the start. My struct contains a balancefactor variable. Anyway the problem is not in my addNode function. The balance factors here are updating perfectly.
My issue is in the delete function. Can someone tell me how does the balance factor of each node get affected after deletion and how the rotations that happen after deletion affect the balance factors of the nodes?
The Answer: Rebalancing
The LR, RL cases don't have unique modifications.