1: // Corrects an imbalance at the node closest to a structural 2: // change in the left subtree of the node's left child. 3: // nodeN is a node, closest to the newly added leaf, at which 4: // an imbalance occurs and that has a left child. 5: // @author Frank M. Carrano, Timothy M. Henry 6: // @version 5.0 7: private BinaryNode<T> rotateRight(BinaryNode<T> nodeN) 8: { 9: BinaryNode<T> nodeC = nodeN.getLeftChild(); 10: nodeN.setLeftChild(nodeC.getRightChild()); 11: nodeC.setRightChild(nodeN); 12: return nodeC; 13: } // end rotateRight 15: // Corrects an imbalance at the node closest to a structural 16: // change in the left subtree of the node's right child. 17: // nodeN is a node, closest to the newly added leaf, at which 18: // an imbalance occurs and that has a right child. 19: private BinaryNode<T> rotateRightLeft(BinaryNode<T> nodeN) 20: { 21: BinaryNode<T> nodeC = nodeN.getRightChild(); 22: nodeN.setRightChild(rotateRight(nodeC)); 23: return rotateLeft(nodeN); 24: } // end rotateRightLeft