Browse Source

Paul: Überarbeitung im SLZ

master
paul-anton.engel@informatik.hs-fulda.de 11 months ago
parent
commit
780e98bfee
  1. 19
      Uebung08/Paul/Main.java
  2. 335
      Uebung08/Paul/RBTree.java
  3. BIN
      bin/Main.class
  4. BIN
      bin/RBTree$Node.class
  5. BIN
      bin/RBTree.class
  6. BIN
      output.svg
  7. 8
      output_step_0.dot
  8. 12
      output_step_1.dot
  9. 48
      output_step_10.dot
  10. 52
      output_step_11.dot
  11. 52
      output_step_12.dot
  12. 56
      output_step_13.dot
  13. 60
      output_step_14.dot
  14. 111
      output_step_15.dot
  15. 16
      output_step_2.dot
  16. 20
      output_step_3.dot
  17. 24
      output_step_4.dot
  18. 28
      output_step_5.dot
  19. 32
      output_step_6.dot
  20. 36
      output_step_7.dot
  21. 40
      output_step_8.dot
  22. 44
      output_step_9.dot

19
Uebung08/Paul/Main.java

@ -1,12 +1,22 @@
import java.util.Random;
import java.util.*;
public class Main {
public static void main(String[] args) {
RBTree<IntComparable> rbTree = new RBTree<>();
Random random = new Random();
RBTree<IntComparable> rbTree = new RBTree<>();
ArrayList<Integer> numbers = new ArrayList<>();
// ein eingebauter Mechanismus, der sicherstellt, dass eine Zahl nicht 2-mal vorkommt, sonst würde der Baum nicht funktionieren
// Füllen der Liste mit Zahlen
for (int j = 1; j <= 100; j++) {
numbers.add(j);
}
//Collections.shuffle(numbers); // Liste mischen
for (int i = 0; i < 15; i++) {
int randomValue = numbers.get(i);
for (int i = 0; i <= 15; i++) {
int randomValue = random.nextInt(100);
IntComparable key = new IntComparable(randomValue);
// Füge das Element ein und aktualisiere die DOT-Datei nach jedem Schritt
@ -19,4 +29,3 @@ public class Main {
// ...
}
}

335
Uebung08/Paul/RBTree.java

@ -11,7 +11,7 @@ class RBTree<T extends Comparable<T>> {
private class Node {
T key;
Node left, right;
Node left, right, parent; // Elternknoten hinzugefügt
boolean color;
Node(T key, boolean color) {
@ -22,38 +22,142 @@ class RBTree<T extends Comparable<T>> {
private Node root;
private Node getUncle(Node parent) {
Node grandparent = parent.parent;
if (grandparent.left == parent) {
return grandparent.right; // right is the uncle
} else if (grandparent.right == parent) {
return grandparent.left; // left is the uncle
} else {
throw new IllegalStateException("Parent is not a child of its grandparent");
}
}
public void insert(T key) {
root = insert(root, key);
root = insert(root, null, key); // Parent für die Wurzel ist null
root.color = BLACK; // Ensure the root is always black
}
private Node insert(Node root, T key) {
if (root == null) {
return new Node(key, RED); // New nodes are always red
}
private Node insert(Node root, Node parent, T key) {
Node node = root;
// Node parent = null;
int cmp = key.compareTo(root.key);
if (cmp < 0) {
root.left = insert(root.left, key);
} else if (cmp > 0) {
root.right = insert(root.right, key);
// Traverse the tree to the left or right depending on the key
while (node != null) {
parent = node;
if (key.compareTo(node.key) < 0) {
node = node.left;
} else if (key.compareTo(node.key) > 0) {
node = node.right;
} else {
throw new IllegalArgumentException("BST already contains a node with key " + key);
}
}
// Insert new node
Node newNode = new Node(key, RED);
if (parent == null) {
root = newNode;
} else if (key.compareTo(parent.key) < 0) {
parent.left = newNode;
} else {
// Duplicate key, do not insert
return root;
parent.right = newNode;
}
newNode.parent = parent;
fixColorafterInsert(newNode);
return newNode;
}
/*
* Fix any Red-Black tree violations
* if (isRed(root.right) && !isRed(root.left)) {
* root = rotateLeft(root);
* }
* if (isRed(root.left) && isRed(root.left.left)) {
* root = rotateRight(root);
* }
* if (isRed(root.left) && isRed(root.right)) {
* flipColors(root);
* }
*/
private void fixColorafterInsert(Node node) {
Node parent = node.parent;
// Case 1: no root, add node as new root, root is always black
if (parent == null) {
node.color = false;
return;
}
// Fix any Red-Black tree violations
if (isRed(root.right) && !isRed(root.left)) {
root = rotateLeft(root);
// Parent is black --> nothing to do
if (parent.color == false) { // Abbildung S.312, aber beide Knoten sind schon schwarz gefärbt
return;
}
if (isRed(root.left) && isRed(root.left.left)) {
root = rotateRight(root);
// From here on, parent(vater) is red
Node grandparent = parent.parent;
Node uncle = getUncle(parent); // Get the uncle (maybe nil, in which case its color is BLACK)
// Case 3 (parent uncle red, Abbildung S.313, 314): recolor parent, grandparent
// and uncle
if (uncle != null && uncle.color == true) {
parent.color = false;
uncle.color = false;
grandparent.color = true;
// Call recursively for grandparent, which is now red. fix recursively
fixColorafterInsert(grandparent);
}
if (isRed(root.left) && isRed(root.right)) {
flipColors(root);
// Parent is left child of grandparent
// Case 4a: Uncle is black(nil is default black) and node is left --> right
// "inner child" of its grandparent
else if (parent == grandparent.left) {
Node newParent;
if (node == parent.right) {
newParent = rotateLeft(parent);
parent = newParent;
// Let "parent" point to the new root node of the rotated sub-tree.
// It will be recolored in the next step, which we're going to fall-through to.
// parent = node;
}
// Case 5a: Uncle is black and node is left->left "outer child" of its
// grandparent
rotateRight(grandparent);
// Recolor original parent and grandparent
parent.color = false;
grandparent.color = true;
}
return root; // Return the updated root
// Parent is right child of grandparent
else if (parent == grandparent.right) {
// Case 4b: Uncle is black and node is right->left "inner child" of its
// grandparent
if (node == parent.left) {
rotateRight(parent);
// Let "parent" point to the new root node of the rotated sub-tree.
// It will be recolored in the next step, which we're going to fall-through to.
parent = node;
}
// Case 5b: Uncle is black and node is right->right "outer child" of its
// grandparent
rotateLeft(grandparent);
// Recolor original parent and grandparent
parent.color = false;
grandparent.color = true;
}
}
private boolean isRed(Node node) {
@ -63,39 +167,107 @@ class RBTree<T extends Comparable<T>> {
return node.color == RED;
}
private Node rotateLeft(Node h) {
Node x = h.right;
h.right = x.left;
x.left = h;
x.color = h.color;
h.color = RED;
return x;
private Node rotateLeft(Node node) {
Node rightChild = node.right;
Node parent = node.parent;
node.right = rightChild.left;
if (rightChild.left != null) {
rightChild.left.parent = node;
}
rightChild.left = node;
node.parent = rightChild;
rightChild.parent = parent;
if (parent == null) {
root = rightChild;
} else if (node == parent.left) {
parent.left = rightChild;
} else if (node == parent.right) {
parent.right = rightChild;
} else {
throw new IllegalStateException("Node is not a child of its parent");
}
if (rightChild != null) {
rightChild.parent = parent;
}
RootBlack();
return rightChild;
}
private Node rotateRight(Node h) {
Node x = h.left;
h.left = x.right;
x.right = h;
x.color = h.color;
h.color = RED;
return x;
private Node rotateRight(Node node) {
Node leftChild = node.left;
Node parent = node.parent;
node.left = leftChild.right;
if (leftChild.right != null) {
leftChild.right.parent = node;
}
leftChild.right = node;
node.parent = leftChild;
leftChild.parent = parent;
if (parent == null) {
root = leftChild;
} else if (node == parent.left) {
parent.left = leftChild;
} else if (node == parent.right) {
parent.right = leftChild;
} else {
throw new IllegalStateException("Node is not a child of its parent");
}
if (leftChild != null) {
leftChild.parent = parent;
}
RootBlack();
return leftChild;
}
private void flipColors(Node h) {
h.color = RED;
h.left.color = BLACK;
h.right.color = BLACK;
private void flipColors(Node node) {
node.color = !node.color;
node.left.color = !node.left.color;
node.right.color = !node.right.color;
}
public void printDOTAfterInsert(String filename, T key) {
private void RootBlack() {
root.color = BLACK;
}
/*
* public void printDOTAfterInsert(String filename, T key) {
* try (FileWriter writer = new FileWriter(filename)) {
* writer.write("digraph G {\n");
* writer.write("\tnode [style=filled, color=black, shape=circle, width=.6,\n");
* writer.write("\t\tfontname=Helvetica, fontweight=bold, fontcolor=white,\n");
* writer.write("\t\tfontsize=24, fixedsize=true];\n");
*
* root = insert(root, null, key); // Füge das Element ein und aktualisiere den
* Baum
* printDOTRecursive(root, writer);
*
* writer.write("}\n");
* } catch (IOException e) {
* e.printStackTrace();
* }
* }
*/
public void printDOTAfterInsert(String filename, T key) {
try (FileWriter writer = new FileWriter(filename)) {
writer.write("digraph G {\n");
writer.write("\tgraph [ratio=.48];\n");
writer.write("\tnode [style=filled, color=black, shape=circle, width=.6 \n");
writer.write("\t\tfontname=Helvetica, fontweight=bold, fontcolor=white, \n");
writer.write("\tnode [style=filled, color=black, shape=circle, width=.6,\n");
writer.write("\t\tfontname=Helvetica, fontweight=bold, fontcolor=white,\n");
writer.write("\t\tfontsize=24, fixedsize=true];\n");
root = insert(root, key); // Füge das Element ein und aktualisiere den Baum
// Hier wird der gesamte Baum gezeichnet, nicht nur der neu eingefügte Schlüssel
printDOTRecursive(root, writer);
writer.write("}\n");
@ -106,22 +278,24 @@ class RBTree<T extends Comparable<T>> {
private void printDOTRecursive(Node node, FileWriter writer) throws IOException {
if (node != null) {
String keyString = node.key.toString().replaceAll("[^a-zA-Z0-9]", "_"); // Ersetze ungültige Zeichen
// Setze Farben basierend auf der Rot-Schwarz-Eigenschaft
String keyString = node.key.toString().replaceAll("[^a-zA-Z0-9]", "_");
String fillColor = (node.color == RED) ? "red" : "black";
String fontColor = (node.color == RED) ? "white" : "white"; // Ändern Sie dies, wenn Sie schwarzen Text auf rotem Hintergrund möchten
String fontColor = (node.color == RED) ? "white" : "white";
// Print current node mit Farbinformationen
writer.write("\t\"" + keyString + "\" [fillcolor=" + fillColor + ", fontcolor=" + fontColor + "];\n");
// Print parent link
if (node.parent != null) {
String parentKeyString = node.parent.key.toString().replaceAll("[^a-zA-Z0-9]", "_");
writer.write("\t\"" + parentKeyString + "\" -> \"" + keyString + "\" [style=dotted];\n");
}
// Print left child
if (node.left != null) {
String leftKeyString = node.left.key.toString().replaceAll("[^a-zA-Z0-9]", "_");
writer.write("\t\"" + keyString + "\" -> \"" + leftKeyString + "\";\n");
printDOTRecursive(node.left, writer);
} else {
// Füge ein NIL-Blatt für leere linke Zweige hinzu
String leftNilKeyString = keyString + "_NIL_L";
writer.write("\t\"" + leftNilKeyString + "\" [shape=plaintext, label=\"NIL\", fontsize=16];\n");
writer.write("\t\"" + keyString + "\" -> \"" + leftNilKeyString + "\";\n");
@ -133,12 +307,69 @@ class RBTree<T extends Comparable<T>> {
writer.write("\t\"" + keyString + "\" -> \"" + rightKeyString + "\";\n");
printDOTRecursive(node.right, writer);
} else {
// Füge ein NIL-Blatt für leere rechte Zweige hinzu
String rightNilKeyString = keyString + "_NIL_R";
writer.write("\t\"" + rightNilKeyString + "\" [shape=plaintext, label=\"NIL\", fontsize=16];\n");
writer.write("\t\"" + keyString + "\" -> \"" + rightNilKeyString + "\";\n");
}
}
}
}
/*public void printDOTAfterInsert(String filename, T key) {
try (FileWriter writer = new FileWriter(filename)) {
writer.write("digraph G {\n");
writer.write("\tnode [style=filled, color=black, shape=circle, width=.6,\n");
writer.write("\t\tfontname=Helvetica, fontweight=bold, fontcolor=white,\n");
writer.write("\t\tfontsize=24, fixedsize=true];\n");
// Hier wird der gesamte Baum gezeichnet, nicht nur der neu eingefügte Schlüssel
printDOTRecursive(root, writer);
writer.write("}\n");
} catch (IOException e) {
e.printStackTrace();
}
}
private void printDOTRecursive(Node node, FileWriter writer) throws IOException {
if (node != null) {
String keyString = node.key.toString().replaceAll("[^a-zA-Z0-9]", "_");
String fillColor = (node.color == RED) ? "red" : "black";
String fontColor = (node.color == RED) ? "white" : "white";
writer.write("\t\"" + keyString + "\" [fillcolor=" + fillColor + ", fontcolor=" + fontColor + "];\n");
/*
* Print parent link
* if (node.parent != null) {
* String parentKeyString =
* node.parent.key.toString().replaceAll("[^a-zA-Z0-9]", "_");
* writer.write("\t\"" + parentKeyString + "\" -> \"" + keyString +
* "\" [style=dotted];\n");
* }
// Print left child
if (node.left != null) {
String leftKeyString = node.left.key.toString().replaceAll("[^a-zA-Z0-9]", "_");
writer.write("\t\"" + keyString + "\" -> \"" + leftKeyString + "\";\n");
printDOTRecursive(node.left, writer);
} else {
String leftNilKeyString = keyString + "_NIL_L";
writer.write("\t\"" + leftNilKeyString + "\" [shape=plaintext, label=\"NIL\", fontsize=16];\n");
writer.write("\t\"" + keyString + "\" -> \"" + leftNilKeyString + "\";\n");
}
// Print right child
if (node.right != null) {
String rightKeyString = node.right.key.toString().replaceAll("[^a-zA-Z0-9]", "_");
writer.write("\t\"" + keyString + "\" -> \"" + rightKeyString + "\";\n");
printDOTRecursive(node.right, writer);
} else {
String rightNilKeyString = keyString + "_NIL_R";
writer.write("\t\"" + rightNilKeyString + "\" [shape=plaintext, label=\"NIL\", fontsize=16];\n");
writer.write("\t\"" + keyString + "\" -> \"" + rightNilKeyString + "\";\n");
}
}
*/
}

BIN
bin/Main.class

BIN
bin/RBTree$Node.class

BIN
bin/RBTree.class

BIN
output.svg

8
output_step_0.dot

@ -1,11 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"56" -> "56_NIL_L";
"56_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"56" -> "56_NIL_R";
}

12
output_step_1.dot

@ -1,15 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "33";
"33" [fillcolor=red, fontcolor=white];
"33_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_L";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"56" -> "56_NIL_R";
}

48
output_step_10.dot

@ -1,51 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=black, fontcolor=white];
"25" -> "15";
"15" [fillcolor=red, fontcolor=white];
"15" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_L";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"15" -> "19";
"19" [fillcolor=black, fontcolor=white];
"19_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_L";
"19_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"69" -> "98";
"98" [fillcolor=black, fontcolor=white];
"98" -> "89";
"89" [fillcolor=red, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
"98_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"98" -> "98_NIL_R";
}

52
output_step_11.dot

@ -1,55 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=black, fontcolor=white];
"25" -> "15";
"15" [fillcolor=red, fontcolor=white];
"15" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11" -> "8";
"8" [fillcolor=red, fontcolor=white];
"8_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_L";
"8_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_R";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"15" -> "19";
"19" [fillcolor=black, fontcolor=white];
"19_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_L";
"19_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"69" -> "98";
"98" [fillcolor=black, fontcolor=white];
"98" -> "89";
"89" [fillcolor=red, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
"98_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"98" -> "98_NIL_R";
}

52
output_step_12.dot

@ -1,55 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=black, fontcolor=white];
"25" -> "15";
"15" [fillcolor=red, fontcolor=white];
"15" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11" -> "8";
"8" [fillcolor=red, fontcolor=white];
"8_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_L";
"8_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_R";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"15" -> "19";
"19" [fillcolor=black, fontcolor=white];
"19_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_L";
"19_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"69" -> "98";
"98" [fillcolor=black, fontcolor=white];
"98" -> "89";
"89" [fillcolor=red, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
"98_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"98" -> "98_NIL_R";
}

56
output_step_13.dot

@ -1,59 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=black, fontcolor=white];
"25" -> "15";
"15" [fillcolor=red, fontcolor=white];
"15" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11" -> "8";
"8" [fillcolor=red, fontcolor=white];
"8_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_L";
"8_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_R";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"15" -> "19";
"19" [fillcolor=black, fontcolor=white];
"19_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_L";
"19_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "64";
"64" [fillcolor=black, fontcolor=white];
"64" -> "63";
"63" [fillcolor=red, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"64_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"64" -> "64_NIL_R";
"69" -> "98";
"98" [fillcolor=black, fontcolor=white];
"98" -> "89";
"89" [fillcolor=red, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
"98_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"98" -> "98_NIL_R";
}

60
output_step_14.dot

@ -1,63 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=black, fontcolor=white];
"25" -> "15";
"15" [fillcolor=red, fontcolor=white];
"15" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11" -> "8";
"8" [fillcolor=red, fontcolor=white];
"8_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_L";
"8_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_R";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"15" -> "19";
"19" [fillcolor=black, fontcolor=white];
"19" -> "18";
"18" [fillcolor=red, fontcolor=white];
"18_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"18" -> "18_NIL_L";
"18_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"18" -> "18_NIL_R";
"19_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "64";
"64" [fillcolor=black, fontcolor=white];
"64" -> "63";
"63" [fillcolor=red, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"64_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"64" -> "64_NIL_R";
"69" -> "98";
"98" [fillcolor=black, fontcolor=white];
"98" -> "89";
"89" [fillcolor=red, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
"98_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"98" -> "98_NIL_R";
}

111
output_step_15.dot

@ -1,67 +1,58 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=red, fontcolor=white];
"25" -> "15";
"15" [fillcolor=black, fontcolor=white];
"15" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11" -> "8";
"8" [fillcolor=red, fontcolor=white];
"8_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_L";
"8_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"8" -> "8_NIL_R";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"15" -> "19";
"19" [fillcolor=black, fontcolor=white];
"19" -> "18";
"18" [fillcolor=red, fontcolor=white];
"18_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"18" -> "18_NIL_L";
"18_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"18" -> "18_NIL_R";
"19_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"19" -> "19_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=black, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33" -> "49";
"49" [fillcolor=black, fontcolor=white];
"49_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"49" -> "49_NIL_L";
"49_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"49" -> "49_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "64";
"64" [fillcolor=black, fontcolor=white];
"64" -> "63";
"63" [fillcolor=red, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"64_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"64" -> "64_NIL_R";
"69" -> "98";
"75" [fillcolor=black, fontcolor=white];
"75" -> "73";
"73" [fillcolor=red, fontcolor=white];
"73" -> "51";
"51" [fillcolor=black, fontcolor=white];
"51" -> "39";
"39" [fillcolor=black, fontcolor=white];
"39" -> "38";
"38" [fillcolor=red, fontcolor=white];
"38" -> "34";
"34" [fillcolor=black, fontcolor=white];
"34" -> "28";
"28" [fillcolor=black, fontcolor=white];
"28" -> "13";
"13" [fillcolor=red, fontcolor=white];
"13_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"13" -> "13_NIL_L";
"13_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"13" -> "13_NIL_R";
"28_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"28" -> "28_NIL_R";
"34" -> "37";
"37" [fillcolor=black, fontcolor=white];
"37_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"37" -> "37_NIL_L";
"37_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"37" -> "37_NIL_R";
"38_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"38" -> "38_NIL_R";
"39_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"39" -> "39_NIL_R";
"51_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"51" -> "51_NIL_R";
"73_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"73" -> "73_NIL_R";
"75" -> "77";
"77" [fillcolor=black, fontcolor=white];
"77_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"77" -> "77_NIL_L";
"77" -> "80";
"80" [fillcolor=black, fontcolor=white];
"80_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"80" -> "80_NIL_L";
"80" -> "98";
"98" [fillcolor=black, fontcolor=white];
"98" -> "89";
"89" [fillcolor=red, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
"98" -> "81";
"81" [fillcolor=black, fontcolor=white];
"81_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"81" -> "81_NIL_L";
"81_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"81" -> "81_NIL_R";
"98_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"98" -> "98_NIL_R";
}

16
output_step_2.dot

@ -1,19 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_L";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
}

20
output_step_3.dot

@ -1,23 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "25";
"25" [fillcolor=red, fontcolor=white];
"25_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"25" -> "25_NIL_L";
"25_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"25" -> "25_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
}

24
output_step_4.dot

@ -1,27 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=red, fontcolor=white];
"25" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_L";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_L";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
}

28
output_step_5.dot

@ -1,31 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=red, fontcolor=white];
"25" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_L";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_L";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "89";
"89" [fillcolor=black, fontcolor=white];
"89" -> "63";
"63" [fillcolor=red, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
}

32
output_step_6.dot

@ -1,35 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=red, fontcolor=white];
"25" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_L";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "89";
"89" [fillcolor=black, fontcolor=white];
"89" -> "63";
"63" [fillcolor=red, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
}

36
output_step_7.dot

@ -1,39 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=black, fontcolor=white];
"25" -> "11";
"11" [fillcolor=black, fontcolor=white];
"11_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_L";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"69" -> "89";
"89" [fillcolor=black, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
}

40
output_step_8.dot

@ -1,43 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=black, fontcolor=white];
"25" -> "15";
"15" [fillcolor=black, fontcolor=white];
"15" -> "11";
"11" [fillcolor=red, fontcolor=white];
"11_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_L";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"15_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"15" -> "15_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"69" -> "89";
"89" [fillcolor=black, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
}

44
output_step_9.dot

@ -1,47 +1,5 @@
digraph G {
graph [ratio=.48];
node [style=filled, color=black, shape=circle, width=.6
node [style=filled, color=black, shape=circle, width=.6,
fontname=Helvetica, fontweight=bold, fontcolor=white,
fontsize=24, fixedsize=true];
"56" [fillcolor=red, fontcolor=white];
"56" -> "25";
"25" [fillcolor=black, fontcolor=white];
"25" -> "15";
"15" [fillcolor=black, fontcolor=white];
"15" -> "11";
"11" [fillcolor=red, fontcolor=white];
"11_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_L";
"11_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"11" -> "11_NIL_R";
"15_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"15" -> "15_NIL_R";
"25" -> "33";
"33" [fillcolor=black, fontcolor=white];
"33" -> "27";
"27" [fillcolor=red, fontcolor=white];
"27_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_L";
"27_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"27" -> "27_NIL_R";
"33_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"33" -> "33_NIL_R";
"56" -> "69";
"69" [fillcolor=black, fontcolor=white];
"69" -> "63";
"63" [fillcolor=black, fontcolor=white];
"63_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_L";
"63_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"63" -> "63_NIL_R";
"69" -> "98";
"98" [fillcolor=black, fontcolor=white];
"98" -> "89";
"89" [fillcolor=red, fontcolor=white];
"89_NIL_L" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_L";
"89_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"89" -> "89_NIL_R";
"98_NIL_R" [shape=plaintext, label="NIL", fontsize=16];
"98" -> "98_NIL_R";
}
Loading…
Cancel
Save