private void rotateLeft ( final Node < K , V > node , final int index ) { Node < K , V > rightChild = node . getRight ( index ) ; node . setRight ( rightChild . getLeft ( index ) , index ) ; if ( rightChild . getLeft ( index ) != null ) { rightChild . getLeft ( index ) . setParent ( node , index ) ; } rightChild . setParent ( node . getParent ( index ) , index ) ; if ( node . getParent ( index ) == null ) { // node was the root ... now its right child is the root rootNode [ index ] = rightChild ; } else if ( node . getParent ( index ) . getLeft ( index ) == node ) { node . getParent ( index ) . setLeft ( rightChild , index ) ; } else { node . getParent ( index ) . setRight ( rightChild , index ) ; } rightChild . setLeft ( node , index ) ; node . setParent ( rightChild , index ) ; }
do a rotate left . standard fare in the world of balanced trees