Loading src/edu/bu/ec504/hw2/BstRotation.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -6,8 +6,8 @@ package edu.bu.ec504.hw2; public class BstRotation { public class BstRotation { public enum RotationType {ZIG, ZAG} public enum RotationType {ZIG, ZAG} public BstRotation(Integer myRotRootID, RotationType myRotType) { public BstRotation(Integer myRotKey, RotationType myRotType) { rotRootID = myRotRootID; rotKey = myRotKey; rotType = myRotType; rotType = myRotType; } } Loading @@ -24,10 +24,10 @@ package edu.bu.ec504.hw2; result.append("ZAG"); result.append("ZAG"); break; break; } } result.append(" on node ID ").append(rotRootID); result.append(" on node ID ").append(rotKey); return result.toString(); return result.toString(); } } private final Integer rotRootID; // the ID of the root of the rotation being performed private final Integer rotKey; // the key of the root of the rotation being performed private final RotationType rotType; // the type of rotation being performed private final RotationType rotType; // the type of rotation being performed } } src/edu/bu/ec504/hw2/rotationalBST.java 0 → 100644 +24 −0 Original line number Original line Diff line number Diff line package edu.bu.ec504.hw2; /** * A Binary Search Tree that can be rotated around nodes. * @inheritDoc */ public class rotationalBST<keyType extends Comparable<keyType>> extends BST<keyType> { /** * @return The number of nodes in the subtree rooted at this node. */ int size() { return 0; } /** * Perform the rotation specified in <code>op</code> on the current tree. * @param op A rotational operation to complete. * @return true iff the rotation was successful. */ boolean rotate(BstRotation op) { return false; } } Loading
src/edu/bu/ec504/hw2/BstRotation.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -6,8 +6,8 @@ package edu.bu.ec504.hw2; public class BstRotation { public class BstRotation { public enum RotationType {ZIG, ZAG} public enum RotationType {ZIG, ZAG} public BstRotation(Integer myRotRootID, RotationType myRotType) { public BstRotation(Integer myRotKey, RotationType myRotType) { rotRootID = myRotRootID; rotKey = myRotKey; rotType = myRotType; rotType = myRotType; } } Loading @@ -24,10 +24,10 @@ package edu.bu.ec504.hw2; result.append("ZAG"); result.append("ZAG"); break; break; } } result.append(" on node ID ").append(rotRootID); result.append(" on node ID ").append(rotKey); return result.toString(); return result.toString(); } } private final Integer rotRootID; // the ID of the root of the rotation being performed private final Integer rotKey; // the key of the root of the rotation being performed private final RotationType rotType; // the type of rotation being performed private final RotationType rotType; // the type of rotation being performed } }
src/edu/bu/ec504/hw2/rotationalBST.java 0 → 100644 +24 −0 Original line number Original line Diff line number Diff line package edu.bu.ec504.hw2; /** * A Binary Search Tree that can be rotated around nodes. * @inheritDoc */ public class rotationalBST<keyType extends Comparable<keyType>> extends BST<keyType> { /** * @return The number of nodes in the subtree rooted at this node. */ int size() { return 0; } /** * Perform the rotation specified in <code>op</code> on the current tree. * @param op A rotational operation to complete. * @return true iff the rotation was successful. */ boolean rotate(BstRotation op) { return false; } }