After performing a rotation to balance an AVL tree, immediately after an insertion, how can I change the balance factor of all the parent nodes (appropriately, by -1 or 1)?
Each node of the AVL tree has the following structure:
typedef struct _avlTree
{
nutbolt part;
int balanceFactor;
struct _avlTree *left,*right;
} *avlTree;
I have set the balance factor as per the definition given on Wikipedia.
Do I need to have a pointer to the parent node in each node?