You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug in AVL Tree rorateLeftLeft and rotateRightRight #325
rotateLeftLeft(rootNode){// Detach left node from root node.constleftNode=rootNode.left;rootNode.setLeft(null);// Make left node to be a child of rootNode's parent.if(rootNode.parent){rootNode.parent.replaceChild(rootNode,leftNode);}elseif(rootNode===this.root){// If root node is root then make left node to be a new root.this.root=leftNode;}// If left node has a right child then detach it and// attach it as a left child for rootNode.if(leftNode.right){rootNode.setLeft(leftNode.right);}// Attach rootNode to the right of leftNode.leftNode.setRight(rootNode);}
rotateRightRight(rootNode){// Detach right node from root node.constrightNode=rootNode.right;rootNode.setRight(null);// Make right node to be a child of rootNode's parent.if(rootNode.parent){rootNode.parent.replaceChild(rootNode,rightNode);}elseif(rootNode===this.root){// If root node is root then make right node to be a new root.this.root=rightNode;}// If right node has a left child then detach it and// attach it as a right child for rootNode.if(rightNode.left){rootNode.setRight(rightNode.left);}// Attach rootNode to the left of rightNode.rightNode.setLeft(rootNode);}
Activity
SHISME commentedon Mar 20, 2019
I found the problem too
oushu1tanqiang1 commentedon Aug 15, 2023
find +1