int show_insert_type(BTreeNode* node) {
par = node;
int leftheight = 0, rightheight = 0;
int J = 0;
int K = 0;
while (par->parent != nullptr)
{
par = par->parent;
leftheight = getHeight(par->left_child);
rightheight = getHeight(par->right_child);
if (abs(leftheight - rightheight) > 1 && par->value != -1)
{
K = 1;
break;
}
}
if (K == 1)
{
if (leftheight - rightheight == 2) // LL , LR
{
if (getHeight(par->left_child->left_child) > getHeight(par->left_child->right_child))
{
return 1; //LL
}
else
{
return 2; //LR
}
}
else if (leftheight - rightheight == -2) // RR , RL
{
if (getHeight(par->right_child->right_child) > getHeight(par->right_child->left_child))
{
return 3; //RR
}
else
{
return 4; //RL
}
}
else {
return 0;
}
}
return 0;
}