rotateRight
Short summary
rotates right around a specified node, doesnt care about balance and stuff, this is done in method reorganizeRightRotate
Return: the new root
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| elem | CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode | the element that should be rotatet around | input |
Code
Declaration
METHOD PROTECTED rotateRight :CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode
VAR_INPUT
(*the element that should be rotatet around*)
elem :CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode;
END_VAR
VAR
newRoot :CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode;
END_VAR
Implementation
__QUERYINTERFACE(elem.leftChild,newRoot);
elem.leftChild := newRoot.rightChild;
newRoot.rightChild := elem;
rotateRight := newRoot;