Commit 0598a173 authored by Kair's avatar Kair

RedBlackTree

parent bee0dd95
...@@ -57,7 +57,7 @@ public class Main { ...@@ -57,7 +57,7 @@ public class Main {
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(root.getData() + root.getColor().toString()); sb.append(root.getData()).append(root.getColor().toString());
String pointerRight = "└──"; String pointerRight = "└──";
String pointerLeft = (root.getRight() != null) ? "├──" : "└──"; String pointerLeft = (root.getRight() != null) ? "├──" : "└──";
...@@ -74,7 +74,7 @@ public class Main { ...@@ -74,7 +74,7 @@ public class Main {
sb.append("\n"); sb.append("\n");
sb.append(padding); sb.append(padding);
sb.append(pointer); sb.append(pointer);
sb.append(node.getData()+node.getColor().toString()); sb.append(node.getData()).append(node.getColor().toString());
StringBuilder paddingBuilder = new StringBuilder(padding); StringBuilder paddingBuilder = new StringBuilder(padding);
if (hasRightSibling) { if (hasRightSibling) {
......
...@@ -20,10 +20,6 @@ public class Node { ...@@ -20,10 +20,6 @@ public class Node {
return color; return color;
} }
public void setData(int data) {
this.data = data;
}
public Node getLeft() { public Node getLeft() {
return left; return left;
} }
......
public class RBTree { public class RBTree {
private static final NodeRB EMPTY = new NodeRB(0);; private static final NodeRB EMPTY = new NodeRB(0);
static { static {
EMPTY.leftNodeRB = EMPTY; EMPTY.leftNodeRB = EMPTY;
EMPTY.rightNodeRB = EMPTY; EMPTY.rightNodeRB = EMPTY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment