/*internal method to insert into subtree is the item to insert is the node that roots the subtree set the new root of the subtree *void insertconst comparable xavlnode ift =nullptr new avlnodexnullptrnullptr }else ifx element insertxt->left )else ift->element insertxt->right )balancet )static const int allowed_imbalance /assume is balanced or within one of being balanced void balanceavlnode ift =nullptr returnifheightt->left heightt->right allowed_imbalance ifheightt->left->left >heightt->left->right rotatewithleftchildt )else doublewithleftchildt )else ifheightt->right heightt->left allowed_imbalance ifheightt->right->right >heightt->right->left rotatewithrightchildt )else doublewithrightchildt ) ->height maxheightt->left )heightt->right figure insertion into an avl tree