All Packages Class Hierarchy This Package Previous Next Index
Interface jdsl.core.api.RestructurableBinaryTree
- public interface RestructurableBinaryTree
- extends BinaryTree
Adds the ability of rotation to a BinaryTree
-
restructure(Position)
-
Applies a rotation to the given position, its parent,
and its grandparent.
restructure
public abstract Position restructure(Position grandchild) throws BoundaryViolationException, InvalidPositionException
- Applies a rotation to the given position, its parent,
and its grandparent. Their in-order order will be preserved, along
with the in-order order of all their children.
- Parameters:
- grandchild - the deepest of the three positions of this
restructuring
- Returns:
- The position now at the root of the newly rotated subtree
- Throws: BoundaryViolationException
- If Position grandchild
is not the grandchild of any Position -- that is, if Position
grandchild is a child of the root, or the root itself.
- Throws: InvalidPositionException
- In addition to all the usual
cases when an IPE is thrown, one is thrown when restructure(.)
is called on an external node.
All Packages Class Hierarchy This Package Previous Next Index