rotateLeft
Short summary
rotates a tree around a node
Return: the new root
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| elem | CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode | The element that sould be rotatet around | input |
Code
Declaration
METHOD PROTECTED rotateLeft :CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode
VAR_INPUT
(*The element that sould be rotatet around*)
elem :CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode;
END_VAR
VAR
newRoot :CNM_CollectionInterfaces.IBalancedBinarySearchTreeNode;
END_VAR
Implementation
__QUERYINTERFACE(elem.rightChild, newRoot);
elem.rightChild := newRoot.leftChild;
newRoot.leftChild := elem;
rotateLeft := newRoot;