Loading src/edu/bu/ec504/hw2/Main.java +1 −1 Original line number Diff line number Diff line package edu.bu.ec504.hw2; import edu.bu.ec504.hw2.bst.BST; import edu.bu.ec504.hw2.bst.BSTRotation; import edu.bu.ec504.hw2.bst.BST.BSTRotation; import java.util.ArrayList; import java.util.Arrays; Loading src/edu/bu/ec504/hw2/bst/BST.java +31 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,37 @@ package edu.bu.ec504.hw2.bst; */ public class BST<keyType extends Comparable<keyType> > { // SUBCLASSES /** * Represents one rotation (ZIG or ZAG) around one key in a Binary Search Tree */ public static class BSTRotation { public enum RotationType {ZIG, ZAG} public BSTRotation(Integer myRotKey, RotationType myRotType) { rotKey = myRotKey; rotType = myRotType; } /** * @return A human-readable description of the rotation */ public String toString() { StringBuilder result = new StringBuilder(); switch (rotType) { case ZIG: result.append("ZIG"); break; case ZAG: result.append("ZAG"); break; } result.append(" on node ID ").append(rotKey); return result.toString(); } private final Integer rotKey; // the key of the root of the rotation being performed private final RotationType rotType; // the type of rotation being performed } /** * Represents the result of a {@link #extendedContains(Comparable)} call. Loading src/edu/bu/ec504/hw2/bst/BSTRotation.javadeleted 100644 → 0 +0 −33 Original line number Diff line number Diff line package edu.bu.ec504.hw2.bst; /** * Represents one rotation (ZIG or ZAG) around one key in a Binary Search Tree */ public class BSTRotation { public enum RotationType {ZIG, ZAG} public BSTRotation(Integer myRotKey, RotationType myRotType) { rotKey = myRotKey; rotType = myRotType; } /** * @return A human-readable description of the rotation */ public String toString() { StringBuilder result = new StringBuilder(); switch (rotType) { case ZIG: result.append("ZIG"); break; case ZAG: result.append("ZAG"); break; } result.append(" on node ID ").append(rotKey); return result.toString(); } private final Integer rotKey; // the key of the root of the rotation being performed private final RotationType rotType; // the type of rotation being performed } Loading
src/edu/bu/ec504/hw2/Main.java +1 −1 Original line number Diff line number Diff line package edu.bu.ec504.hw2; import edu.bu.ec504.hw2.bst.BST; import edu.bu.ec504.hw2.bst.BSTRotation; import edu.bu.ec504.hw2.bst.BST.BSTRotation; import java.util.ArrayList; import java.util.Arrays; Loading
src/edu/bu/ec504/hw2/bst/BST.java +31 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,37 @@ package edu.bu.ec504.hw2.bst; */ public class BST<keyType extends Comparable<keyType> > { // SUBCLASSES /** * Represents one rotation (ZIG or ZAG) around one key in a Binary Search Tree */ public static class BSTRotation { public enum RotationType {ZIG, ZAG} public BSTRotation(Integer myRotKey, RotationType myRotType) { rotKey = myRotKey; rotType = myRotType; } /** * @return A human-readable description of the rotation */ public String toString() { StringBuilder result = new StringBuilder(); switch (rotType) { case ZIG: result.append("ZIG"); break; case ZAG: result.append("ZAG"); break; } result.append(" on node ID ").append(rotKey); return result.toString(); } private final Integer rotKey; // the key of the root of the rotation being performed private final RotationType rotType; // the type of rotation being performed } /** * Represents the result of a {@link #extendedContains(Comparable)} call. Loading
src/edu/bu/ec504/hw2/bst/BSTRotation.javadeleted 100644 → 0 +0 −33 Original line number Diff line number Diff line package edu.bu.ec504.hw2.bst; /** * Represents one rotation (ZIG or ZAG) around one key in a Binary Search Tree */ public class BSTRotation { public enum RotationType {ZIG, ZAG} public BSTRotation(Integer myRotKey, RotationType myRotType) { rotKey = myRotKey; rotType = myRotType; } /** * @return A human-readable description of the rotation */ public String toString() { StringBuilder result = new StringBuilder(); switch (rotType) { case ZIG: result.append("ZIG"); break; case ZAG: result.append("ZAG"); break; } result.append(" on node ID ").append(rotKey); return result.toString(); } private final Integer rotKey; // the key of the root of the rotation being performed private final RotationType rotType; // the type of rotation being performed }