diff --git a/Java/Red and Black Tree/.classpath b/Java/Red and Black Tree/.classpath
new file mode 100644
index 0000000..54e318a
--- /dev/null
+++ b/Java/Red and Black Tree/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/.project b/Java/Red and Black Tree/.project
new file mode 100644
index 0000000..6bd0b62
--- /dev/null
+++ b/Java/Red and Black Tree/.project
@@ -0,0 +1,23 @@
+
+
+ Red and Black Tree
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.xtext.ui.shared.xtextBuilder
+
+
+
+
+
+ org.eclipse.xtext.ui.shared.xtextNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Java/Red and Black Tree/.settings/org.eclipse.jdt.core.prefs b/Java/Red and Black Tree/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/Java/Red and Black Tree/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Java/Red and Black Tree/bin/.classpath b/Java/Red and Black Tree/bin/.classpath
new file mode 100644
index 0000000..3b2e843
--- /dev/null
+++ b/Java/Red and Black Tree/bin/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/bin/application/application.css b/Java/Red and Black Tree/bin/application/application.css
new file mode 100644
index 0000000..83d6f33
--- /dev/null
+++ b/Java/Red and Black Tree/bin/application/application.css
@@ -0,0 +1 @@
+/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */
\ No newline at end of file
diff --git a/Java/Red and Black Tree/bin/rbtree/Main.class b/Java/Red and Black Tree/bin/rbtree/Main.class
new file mode 100644
index 0000000..20bc3ad
Binary files /dev/null and b/Java/Red and Black Tree/bin/rbtree/Main.class differ
diff --git a/Java/Red and Black Tree/bin/rbtree/RBNode.class b/Java/Red and Black Tree/bin/rbtree/RBNode.class
new file mode 100644
index 0000000..37b1fec
Binary files /dev/null and b/Java/Red and Black Tree/bin/rbtree/RBNode.class differ
diff --git a/Java/Red and Black Tree/bin/rbtree/RedBlackTree.class b/Java/Red and Black Tree/bin/rbtree/RedBlackTree.class
new file mode 100644
index 0000000..b9d3b99
Binary files /dev/null and b/Java/Red and Black Tree/bin/rbtree/RedBlackTree.class differ
diff --git a/Java/Red and Black Tree/build.fxbuild b/Java/Red and Black Tree/build.fxbuild
new file mode 100644
index 0000000..d9407ee
--- /dev/null
+++ b/Java/Red and Black Tree/build.fxbuild
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/allclasses-frame.html b/Java/Red and Black Tree/doc/allclasses-frame.html
new file mode 100644
index 0000000..7063800
--- /dev/null
+++ b/Java/Red and Black Tree/doc/allclasses-frame.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+All Classes
+
+
+
+
+
+All Classes
+
+
+
diff --git a/Java/Red and Black Tree/doc/allclasses-noframe.html b/Java/Red and Black Tree/doc/allclasses-noframe.html
new file mode 100644
index 0000000..54c40cd
--- /dev/null
+++ b/Java/Red and Black Tree/doc/allclasses-noframe.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+All Classes
+
+
+
+
+
+All Classes
+
+
+
diff --git a/Java/Red and Black Tree/doc/constant-values.html b/Java/Red and Black Tree/doc/constant-values.html
new file mode 100644
index 0000000..75d00ab
--- /dev/null
+++ b/Java/Red and Black Tree/doc/constant-values.html
@@ -0,0 +1,122 @@
+
+
+
+
+
+Constant Field Values
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/deprecated-list.html b/Java/Red and Black Tree/doc/deprecated-list.html
new file mode 100644
index 0000000..d4ac276
--- /dev/null
+++ b/Java/Red and Black Tree/doc/deprecated-list.html
@@ -0,0 +1,122 @@
+
+
+
+
+
+Deprecated List
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/help-doc.html b/Java/Red and Black Tree/doc/help-doc.html
new file mode 100644
index 0000000..b5eb092
--- /dev/null
+++ b/Java/Red and Black Tree/doc/help-doc.html
@@ -0,0 +1,223 @@
+
+
+
+
+
+API Help
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+Package
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+
+Interfaces (italic)
+Classes
+Enums
+Exceptions
+Errors
+Annotation Types
+
+
+
+Class/Interface
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+
+Class inheritance diagram
+Direct Subclasses
+All Known Subinterfaces
+All Known Implementing Classes
+Class/interface declaration
+Class/interface description
+
+
+Nested Class Summary
+Field Summary
+Constructor Summary
+Method Summary
+
+
+Field Detail
+Constructor Detail
+Method Detail
+
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+
+
+Annotation Type
+Each annotation type has its own separate page with the following sections:
+
+Annotation Type declaration
+Annotation Type description
+Required Element Summary
+Optional Element Summary
+Element Detail
+
+
+
+Enum
+Each enum has its own separate page with the following sections:
+
+Enum declaration
+Enum description
+Enum Constant Summary
+Enum Constant Detail
+
+
+
+Use
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+
+
+Tree (Class Hierarchy)
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
+
+When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
+When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+
+
+Deprecated API
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+
+
+Index
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+
+
+Prev/Next
+These links take you to the next or previous class, interface, package, or related page.
+
+
+Frames/No Frames
+These links show and hide the HTML frames. All pages are available with or without frames.
+
+
+All Classes
+The All Classes link shows all classes and interfaces except non-static nested types.
+
+
+Serialized Form
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+
+
+Constant Field Values
+The Constant Field Values page lists the static final fields and their values.
+
+
+
This help file applies to API documentation generated using the standard doclet.
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-1.html b/Java/Red and Black Tree/doc/index-files/index-1.html
new file mode 100644
index 0000000..d843561
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-1.html
@@ -0,0 +1,133 @@
+
+
+
+
+
+B-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
B
+
+breadthfirst() - Method in class rbtree.RedBlackTree
+
+A helper method for the breadth first traversal method.
+
+breadthfirst(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Traverses through the red black tree using breadth first algorithm.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-10.html b/Java/Red and Black Tree/doc/index-files/index-10.html
new file mode 100644
index 0000000..e026113
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-10.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+S-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
S
+
+setData(E) - Method in class rbtree.RBNode
+
+A setter for the node.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-2.html b/Java/Red and Black Tree/doc/index-files/index-2.html
new file mode 100644
index 0000000..72cf41d
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-2.html
@@ -0,0 +1,133 @@
+
+
+
+
+
+D-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
D
+
+delete(E) - Method in class rbtree.RedBlackTree
+
+A helper method to delete a node.
+
+delete(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Deletes the node.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-3.html b/Java/Red and Black Tree/doc/index-files/index-3.html
new file mode 100644
index 0000000..6deb2d2
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-3.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+F-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
F
+
+find(E) - Method in class rbtree.RedBlackTree
+
+Finds if the data exists in red black tree based off of parameter.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-4.html b/Java/Red and Black Tree/doc/index-files/index-4.html
new file mode 100644
index 0000000..f3c87b9
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-4.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+G-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
G
+
+getData() - Method in class rbtree.RBNode
+
+A getter for the value inside the node.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-5.html b/Java/Red and Black Tree/doc/index-files/index-5.html
new file mode 100644
index 0000000..e185732
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-5.html
@@ -0,0 +1,153 @@
+
+
+
+
+
+I-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
I
+
+inorder() - Method in class rbtree.RedBlackTree
+
+A helper method for the in order traversal method.
+
+insert(E) - Method in class rbtree.RedBlackTree
+
+Inserts a node into the red and black tree.
+
+insertionPoint(E) - Method in class rbtree.RedBlackTree
+
+Finds the spot of the parent of the node we will be inserting into the tree.
+
+isEmpty() - Method in class rbtree.RedBlackTree
+
+Checks to see if a tree is empty or not.
+
+isLeaf(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Checks to see if a node is a leaf.
+
+isLeftChild(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Checks if a node is a left child.
+
+isRightChild(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Checks if a node is a right child.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-6.html b/Java/Red and Black Tree/doc/index-files/index-6.html
new file mode 100644
index 0000000..e9d48e9
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-6.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+M-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
M
+
+maxLeftSubtree(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Finds the max node in the left sub tree of a node.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-7.html b/Java/Red and Black Tree/doc/index-files/index-7.html
new file mode 100644
index 0000000..e145903
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-7.html
@@ -0,0 +1,133 @@
+
+
+
+
+
+N-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
N
+
+nodeToDelete(E) - Method in class rbtree.RedBlackTree
+
+Finds the node that will be deleted.
+
+numChildren(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Counts the number of children of a node in the red black tree.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-8.html b/Java/Red and Black Tree/doc/index-files/index-8.html
new file mode 100644
index 0000000..db8eb0d
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-8.html
@@ -0,0 +1,146 @@
+
+
+
+
+
+P-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
P
+
+postorder() - Method in class rbtree.RedBlackTree
+
+A helper method for the post order traversal method.
+
+preorder() - Method in class rbtree.RedBlackTree
+
+A helper method for the pre order traversal method.
+
+preorder(RBNode<E>, ArrayList<RBNode<E>>) - Method in class rbtree.RedBlackTree
+
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+printList(ArrayList<RBNode<E>>) - Method in class rbtree.RedBlackTree
+
+Prints an array list.
+
+printTree() - Method in class rbtree.RedBlackTree
+
+Prints the tree.
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index-files/index-9.html b/Java/Red and Black Tree/doc/index-files/index-9.html
new file mode 100644
index 0000000..dd83197
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index-files/index-9.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+R-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B D F G I M N P R S
+
+
+
R
+
+RBNode <E extends java.lang.Comparable<E >> - Class in rbtree
+
+RBNode(E) - Constructor for class rbtree.RBNode
+
+Creates an RBNode.
+
+rbtree - package rbtree
+
+RedBlackTree <E extends java.lang.Comparable<E >> - Class in rbtree
+
+RedBlackTree() - Constructor for class rbtree.RedBlackTree
+
+RedBlackTree(E[]) - Constructor for class rbtree.RedBlackTree
+
+
+
B D F G I M N P R S
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/index.html b/Java/Red and Black Tree/doc/index.html
new file mode 100644
index 0000000..72167be
--- /dev/null
+++ b/Java/Red and Black Tree/doc/index.html
@@ -0,0 +1,72 @@
+
+
+
+
+
+Generated Documentation (Untitled)
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+Frame Alert
+This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version .
+
+
+
diff --git a/Java/Red and Black Tree/doc/overview-tree.html b/Java/Red and Black Tree/doc/overview-tree.html
new file mode 100644
index 0000000..af3e888
--- /dev/null
+++ b/Java/Red and Black Tree/doc/overview-tree.html
@@ -0,0 +1,136 @@
+
+
+
+
+
+Class Hierarchy
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/package-list b/Java/Red and Black Tree/doc/package-list
new file mode 100644
index 0000000..893ee01
--- /dev/null
+++ b/Java/Red and Black Tree/doc/package-list
@@ -0,0 +1 @@
+rbtree
diff --git a/Java/Red and Black Tree/doc/rbtree/Main.html b/Java/Red and Black Tree/doc/rbtree/Main.html
new file mode 100644
index 0000000..df07c79
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/Main.html
@@ -0,0 +1,328 @@
+
+
+
+
+
+Main
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+java.lang.Object
+
+
+javafx.application.Application
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Nested Class Summary
+
+
+
+
+Nested classes/interfaces inherited from class javafx.application.Application
+javafx.application.Application.Parameters
+
+
+
+
+
+
+
+
+Field Summary
+
+
+
+
+Fields inherited from class javafx.application.Application
+STYLESHEET_CASPIAN, STYLESHEET_MODENA
+
+
+
+
+
+
+
+
+Constructor Summary
+
+Constructors
+
+Constructor and Description
+
+
+Main ()
+
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+
+Methods inherited from class javafx.application.Application
+getHostServices, getParameters, getUserAgentStylesheet, init, launch, launch, notifyPreloader, setUserAgentStylesheet, stop
+
+
+
+
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Detail
+
+
+
+
+
+Main
+public Main()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/RBNode.html b/Java/Red and Black Tree/doc/rbtree/RBNode.html
new file mode 100644
index 0000000..b8471aa
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/RBNode.html
@@ -0,0 +1,307 @@
+
+
+
+
+
+RBNode
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+java.lang.Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+Constructors
+
+Constructor and Description
+
+
+RBNode (E data)
+Creates an RBNode.
+
+
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Detail
+
+
+
+
+
+
+
+RBNode
+public RBNode(E data)
+Creates an RBNode.
+
+Parameters:
+data - is the data that is stored in the given node.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/RedBlackTree.html b/Java/Red and Black Tree/doc/rbtree/RedBlackTree.html
new file mode 100644
index 0000000..774b39a
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/RedBlackTree.html
@@ -0,0 +1,704 @@
+
+
+
+
+
+RedBlackTree
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+java.lang.Object
+
+
+rbtree.RedBlackTree<E>
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+
+
+
+
+
+Method Summary
+
+All Methods Instance Methods Concrete Methods
+
+Modifier and Type
+Method and Description
+
+
+java.util.ArrayList<RBNode <E >>
+breadthfirst ()
+A helper method for the breadth first traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+breadthfirst (RBNode <E > node)
+Traverses through the red black tree using breadth first algorithm.
+
+
+
+void
+delete (E key)
+A helper method to delete a node.
+
+
+
+void
+delete (RBNode <E > node)
+Deletes the node.
+
+
+
+boolean
+find (E key)
+Finds if the data exists in red black tree based off of parameter.
+
+
+
+java.util.ArrayList<RBNode <E >>
+inorder ()
+A helper method for the in order traversal method.
+
+
+
+void
+insert (E key)
+Inserts a node into the red and black tree.
+
+
+
+RBNode <E >
+insertionPoint (E key)
+Finds the spot of the parent of the node we will be inserting into the tree.
+
+
+
+boolean
+isEmpty ()
+Checks to see if a tree is empty or not.
+
+
+
+boolean
+isLeaf (RBNode <E > node)
+Checks to see if a node is a leaf.
+
+
+
+boolean
+isLeftChild (RBNode <E > node)
+Checks if a node is a left child.
+
+
+
+boolean
+isRightChild (RBNode <E > node)
+Checks if a node is a right child.
+
+
+
+RBNode <E >
+maxLeftSubtree (RBNode <E > node)
+Finds the max node in the left sub tree of a node.
+
+
+
+RBNode <E >
+nodeToDelete (E key)
+Finds the node that will be deleted.
+
+
+
+int
+numChildren (RBNode <E > node)
+Counts the number of children of a node in the red black tree.
+
+
+
+java.util.ArrayList<RBNode <E >>
+postorder ()
+A helper method for the post order traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+preorder ()
+A helper method for the pre order traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+preorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+
+
+void
+printList (java.util.ArrayList<RBNode <E >> myList)
+Prints an array list.
+
+
+
+void
+printTree ()
+Prints the tree.
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Detail
+
+
+
+
+
+RedBlackTree
+public RedBlackTree()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+printTree
+public void printTree()
+Prints the tree.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+preorder
+public java.util.ArrayList<RBNode <E >> preorder(RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+Parameters:
+node - the node being sent into method.
+myList - is the array list used to store nodes.
+Returns:
+the array list with the nodes in the appropriate order.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/RedBlackTree.zip b/Java/Red and Black Tree/doc/rbtree/RedBlackTree.zip
new file mode 100644
index 0000000..93befde
Binary files /dev/null and b/Java/Red and Black Tree/doc/rbtree/RedBlackTree.zip differ
diff --git a/Java/Red and Black Tree/doc/rbtree/class-use/Main.html b/Java/Red and Black Tree/doc/rbtree/class-use/Main.html
new file mode 100644
index 0000000..3ad7f5a
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/class-use/Main.html
@@ -0,0 +1,122 @@
+
+
+
+
+
+Uses of Class rbtree.Main
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+No usage of rbtree.Main
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/class-use/RBNode.html b/Java/Red and Black Tree/doc/rbtree/class-use/RBNode.html
new file mode 100644
index 0000000..8ab850e
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/class-use/RBNode.html
@@ -0,0 +1,290 @@
+
+
+
+
+
+Uses of Class rbtree.RBNode
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Methods in rbtree that return RBNode
+
+Modifier and Type
+Method and Description
+
+
+
+RBNode <E >
+RedBlackTree. insertionPoint (E key)
+Finds the spot of the parent of the node we will be inserting into the tree.
+
+
+
+RBNode <E >
+RedBlackTree. maxLeftSubtree (RBNode <E > node)
+Finds the max node in the left sub tree of a node.
+
+
+
+RBNode <E >
+RedBlackTree. nodeToDelete (E key)
+Finds the node that will be deleted.
+
+
+
+
+
+Methods in rbtree that return types with arguments of type RBNode
+
+Modifier and Type
+Method and Description
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. breadthfirst ()
+A helper method for the breadth first traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. breadthfirst (RBNode <E > node)
+Traverses through the red black tree using breadth first algorithm.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. inorder ()
+A helper method for the in order traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. postorder ()
+A helper method for the post order traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. preorder ()
+A helper method for the pre order traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. preorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+
+
+
+
+Methods in rbtree with parameters of type RBNode
+
+Modifier and Type
+Method and Description
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. breadthfirst (RBNode <E > node)
+Traverses through the red black tree using breadth first algorithm.
+
+
+
+void
+RedBlackTree. delete (RBNode <E > node)
+Deletes the node.
+
+
+
+boolean
+RedBlackTree. isLeaf (RBNode <E > node)
+Checks to see if a node is a leaf.
+
+
+
+boolean
+RedBlackTree. isLeftChild (RBNode <E > node)
+Checks if a node is a left child.
+
+
+
+boolean
+RedBlackTree. isRightChild (RBNode <E > node)
+Checks if a node is a right child.
+
+
+
+RBNode <E >
+RedBlackTree. maxLeftSubtree (RBNode <E > node)
+Finds the max node in the left sub tree of a node.
+
+
+
+int
+RedBlackTree. numChildren (RBNode <E > node)
+Counts the number of children of a node in the red black tree.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. preorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+
+
+
+
+Method parameters in rbtree with type arguments of type RBNode
+
+Modifier and Type
+Method and Description
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. preorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+
+
+void
+RedBlackTree. printList (java.util.ArrayList<RBNode <E >> myList)
+Prints an array list.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/class-use/RedBlackTree.html b/Java/Red and Black Tree/doc/rbtree/class-use/RedBlackTree.html
new file mode 100644
index 0000000..886336c
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/class-use/RedBlackTree.html
@@ -0,0 +1,122 @@
+
+
+
+
+
+Uses of Class rbtree.RedBlackTree
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+No usage of rbtree.RedBlackTree
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/package-frame.html b/Java/Red and Black Tree/doc/rbtree/package-frame.html
new file mode 100644
index 0000000..8fc8e77
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/package-frame.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+rbtree
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/package-summary.html b/Java/Red and Black Tree/doc/rbtree/package-summary.html
new file mode 100644
index 0000000..79fdbcf
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/package-summary.html
@@ -0,0 +1,144 @@
+
+
+
+
+
+rbtree
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Prev Package
+Next Package
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Class Summary
+
+Class
+Description
+
+
+
+RBNode <E extends java.lang.Comparable<E>>
+
+
+
+RedBlackTree <E extends java.lang.Comparable<E>>
+
+
+
+
+
+
+
+
+
+
+
+Prev Package
+Next Package
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/package-tree.html b/Java/Red and Black Tree/doc/rbtree/package-tree.html
new file mode 100644
index 0000000..a608a0c
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/package-tree.html
@@ -0,0 +1,132 @@
+
+
+
+
+
+rbtree Class Hierarchy
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/package-use.html b/Java/Red and Black Tree/doc/rbtree/package-use.html
new file mode 100644
index 0000000..7b00d8f
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/package-use.html
@@ -0,0 +1,140 @@
+
+
+
+
+
+Uses of Package rbtree
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/allclasses-frame.html b/Java/Red and Black Tree/doc/rbtree/private/allclasses-frame.html
new file mode 100644
index 0000000..fe37d47
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/allclasses-frame.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+All Classes
+
+
+
+
+
+All Classes
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/allclasses-noframe.html b/Java/Red and Black Tree/doc/rbtree/private/allclasses-noframe.html
new file mode 100644
index 0000000..27e48f7
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/allclasses-noframe.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+All Classes
+
+
+
+
+
+All Classes
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/constant-values.html b/Java/Red and Black Tree/doc/rbtree/private/constant-values.html
new file mode 100644
index 0000000..e5b9a01
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/constant-values.html
@@ -0,0 +1,122 @@
+
+
+
+
+
+Constant Field Values
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/deprecated-list.html b/Java/Red and Black Tree/doc/rbtree/private/deprecated-list.html
new file mode 100644
index 0000000..5d844d2
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/deprecated-list.html
@@ -0,0 +1,122 @@
+
+
+
+
+
+Deprecated List
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/help-doc.html b/Java/Red and Black Tree/doc/rbtree/private/help-doc.html
new file mode 100644
index 0000000..8d7b81b
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/help-doc.html
@@ -0,0 +1,223 @@
+
+
+
+
+
+API Help
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+Package
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+
+Interfaces (italic)
+Classes
+Enums
+Exceptions
+Errors
+Annotation Types
+
+
+
+Class/Interface
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+
+Class inheritance diagram
+Direct Subclasses
+All Known Subinterfaces
+All Known Implementing Classes
+Class/interface declaration
+Class/interface description
+
+
+Nested Class Summary
+Field Summary
+Constructor Summary
+Method Summary
+
+
+Field Detail
+Constructor Detail
+Method Detail
+
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+
+
+Annotation Type
+Each annotation type has its own separate page with the following sections:
+
+Annotation Type declaration
+Annotation Type description
+Required Element Summary
+Optional Element Summary
+Element Detail
+
+
+
+Enum
+Each enum has its own separate page with the following sections:
+
+Enum declaration
+Enum description
+Enum Constant Summary
+Enum Constant Detail
+
+
+
+Use
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+
+
+Tree (Class Hierarchy)
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
+
+When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
+When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+
+
+Deprecated API
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+
+
+Index
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+
+
+Prev/Next
+These links take you to the next or previous class, interface, package, or related page.
+
+
+Frames/No Frames
+These links show and hide the HTML frames. All pages are available with or without frames.
+
+
+All Classes
+The All Classes link shows all classes and interfaces except non-static nested types.
+
+
+Serialized Form
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+
+
+Constant Field Values
+The Constant Field Values page lists the static final fields and their values.
+
+
+
This help file applies to API documentation generated using the standard doclet.
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-1.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-1.html
new file mode 100644
index 0000000..5ea2bc2
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-1.html
@@ -0,0 +1,133 @@
+
+
+
+
+
+B-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
B
+
+breadthfirst() - Method in class rbtree.RedBlackTree
+
+A helper method for the breadth first traversal method.
+
+breadthfirst(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Traverses through the red black tree using breadth first algorithm.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-10.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-10.html
new file mode 100644
index 0000000..88ab6f0
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-10.html
@@ -0,0 +1,161 @@
+
+
+
+
+
+P-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
P
+
+parent - Variable in class rbtree.RBNode
+
+postorder() - Method in class rbtree.RedBlackTree
+
+A helper method for the post order traversal method.
+
+postorder(RBNode<E>, ArrayList<RBNode<E>>) - Method in class rbtree.RedBlackTree
+
+Traverses through the red black tree using the post order traversal, and puts
+ values into an array list.
+
+preorder() - Method in class rbtree.RedBlackTree
+
+A helper method for the pre order traversal method.
+
+preorder(RBNode<E>, ArrayList<RBNode<E>>) - Method in class rbtree.RedBlackTree
+
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+printList(ArrayList<RBNode<E>>) - Method in class rbtree.RedBlackTree
+
+Prints an array list.
+
+printNodeValue(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Prints the value in the node.
+
+printTree() - Method in class rbtree.RedBlackTree
+
+Prints the tree.
+
+printTree(RBNode<E>, boolean, String) - Method in class rbtree.RedBlackTree
+
+Prints the tree
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-11.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-11.html
new file mode 100644
index 0000000..050bd42
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-11.html
@@ -0,0 +1,147 @@
+
+
+
+
+
+R-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
R
+
+RBNode <E extends java.lang.Comparable<E >> - Class in rbtree
+
+RBNode(E) - Constructor for class rbtree.RBNode
+
+Creates an RBNode.
+
+rbtree - package rbtree
+
+RedBlackTree <E extends java.lang.Comparable<E >> - Class in rbtree
+
+RedBlackTree() - Constructor for class rbtree.RedBlackTree
+
+RedBlackTree(E[]) - Constructor for class rbtree.RedBlackTree
+
+right - Variable in class rbtree.RBNode
+
+rightRotate(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Right rotates the tree to ensure red and black tree properties are fulfilled.
+
+root - Variable in class rbtree.RedBlackTree
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-12.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-12.html
new file mode 100644
index 0000000..a0a5a4b
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-12.html
@@ -0,0 +1,133 @@
+
+
+
+
+
+S-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
S
+
+setData(E) - Method in class rbtree.RBNode
+
+A setter for the node.
+
+sibling(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Finds the sibling of a node.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-13.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-13.html
new file mode 100644
index 0000000..b21c0ca
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-13.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+U-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
U
+
+uncle(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Finds the uncle of a node.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-2.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-2.html
new file mode 100644
index 0000000..31b14b2
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-2.html
@@ -0,0 +1,127 @@
+
+
+
+
+
+C-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
C
+
+color - Variable in class rbtree.RBNode
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-3.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-3.html
new file mode 100644
index 0000000..06a50c7
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-3.html
@@ -0,0 +1,135 @@
+
+
+
+
+
+D-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
D
+
+data - Variable in class rbtree.RBNode
+
+delete(E) - Method in class rbtree.RedBlackTree
+
+A helper method to delete a node.
+
+delete(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Deletes the node.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-4.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-4.html
new file mode 100644
index 0000000..83a9e12
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-4.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+F-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
F
+
+find(E) - Method in class rbtree.RedBlackTree
+
+Finds if the data exists in red black tree based off of parameter.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-5.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-5.html
new file mode 100644
index 0000000..de44945
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-5.html
@@ -0,0 +1,133 @@
+
+
+
+
+
+G-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
G
+
+getData() - Method in class rbtree.RBNode
+
+A getter for the value inside the node.
+
+grandparent(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Finds the grandparent of a node.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-6.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-6.html
new file mode 100644
index 0000000..0de055a
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-6.html
@@ -0,0 +1,163 @@
+
+
+
+
+
+I-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
I
+
+inorder() - Method in class rbtree.RedBlackTree
+
+A helper method for the in order traversal method.
+
+inorder(RBNode<E>, ArrayList<RBNode<E>>) - Method in class rbtree.RedBlackTree
+
+Traverses through the red black tree using the in order traversal, and puts
+ values into an array list.
+
+insert(E) - Method in class rbtree.RedBlackTree
+
+Inserts a node into the red and black tree.
+
+insertCleanUp(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Implements the red and black tree properties, and ensures the tree be balanced correctly with
+ the correct color for each node.
+
+insertionPoint(E) - Method in class rbtree.RedBlackTree
+
+Finds the spot of the parent of the node we will be inserting into the tree.
+
+isEmpty() - Method in class rbtree.RedBlackTree
+
+Checks to see if a tree is empty or not.
+
+isLeaf(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Checks to see if a node is a leaf.
+
+isLeftChild(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Checks if a node is a left child.
+
+isRightChild(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Checks if a node is a right child.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-7.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-7.html
new file mode 100644
index 0000000..dddf4c4
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-7.html
@@ -0,0 +1,131 @@
+
+
+
+
+
+L-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
L
+
+left - Variable in class rbtree.RBNode
+
+leftRotate(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Left rotates the tree to ensure red and black tree properties are fulfilled.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-8.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-8.html
new file mode 100644
index 0000000..b4167c1
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-8.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+M-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
M
+
+maxLeftSubtree(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Finds the max node in the left sub tree of a node.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index-files/index-9.html b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-9.html
new file mode 100644
index 0000000..b063b80
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index-files/index-9.html
@@ -0,0 +1,135 @@
+
+
+
+
+
+N-Index
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+B C D F G I L M N P R S U
+
+
+
N
+
+NIL - Variable in class rbtree.RedBlackTree
+
+nodeToDelete(E) - Method in class rbtree.RedBlackTree
+
+Finds the node that will be deleted.
+
+numChildren(RBNode<E>) - Method in class rbtree.RedBlackTree
+
+Counts the number of children of a node in the red black tree.
+
+
+
B C D F G I L M N P R S U
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/index.html b/Java/Red and Black Tree/doc/rbtree/private/index.html
new file mode 100644
index 0000000..2a3c4e7
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/index.html
@@ -0,0 +1,72 @@
+
+
+
+
+
+Generated Documentation (Untitled)
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+Frame Alert
+This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version .
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/overview-tree.html b/Java/Red and Black Tree/doc/rbtree/private/overview-tree.html
new file mode 100644
index 0000000..2ec17d7
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/overview-tree.html
@@ -0,0 +1,136 @@
+
+
+
+
+
+Class Hierarchy
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/package-list b/Java/Red and Black Tree/doc/rbtree/private/package-list
new file mode 100644
index 0000000..893ee01
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/package-list
@@ -0,0 +1 @@
+rbtree
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/RBNode.html b/Java/Red and Black Tree/doc/rbtree/private/rbtree/RBNode.html
new file mode 100644
index 0000000..1939410
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/rbtree/RBNode.html
@@ -0,0 +1,395 @@
+
+
+
+
+
+RBNode
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+java.lang.Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+
+
+
+
+
+
+
+Constructor Summary
+
+Constructors
+
+Constructor and Description
+
+
+RBNode (E data)
+Creates an RBNode.
+
+
+
+
+
+
+
+
+
+
+Method Summary
+
+
+
+
+
+Methods inherited from class java.lang.Object
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Detail
+
+
+
+
+
+
+
+RBNode
+public RBNode(E data)
+Creates an RBNode.
+
+Parameters:
+data - is the data that is stored in the given node.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/RedBlackTree.html b/Java/Red and Black Tree/doc/rbtree/private/rbtree/RedBlackTree.html
new file mode 100644
index 0000000..7e5d417
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/rbtree/RedBlackTree.html
@@ -0,0 +1,981 @@
+
+
+
+
+
+RedBlackTree
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+java.lang.Object
+
+
+rbtree.RedBlackTree<E>
+
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+Fields
+
+Modifier and Type
+Field and Description
+
+
+private RBNode <E >
+NIL
+
+
+private RBNode <E >
+root
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+
+
+
+
+
+
+
+Method Summary
+
+All Methods Instance Methods Concrete Methods
+
+Modifier and Type
+Method and Description
+
+
+java.util.ArrayList<RBNode <E >>
+breadthfirst ()
+A helper method for the breadth first traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+breadthfirst (RBNode <E > node)
+Traverses through the red black tree using breadth first algorithm.
+
+
+
+void
+delete (E key)
+A helper method to delete a node.
+
+
+
+void
+delete (RBNode <E > node)
+Deletes the node.
+
+
+
+boolean
+find (E key)
+Finds if the data exists in red black tree based off of parameter.
+
+
+
+(package private) RBNode <E >
+grandparent (RBNode <E > node)
+Finds the grandparent of a node.
+
+
+
+java.util.ArrayList<RBNode <E >>
+inorder ()
+A helper method for the in order traversal method.
+
+
+
+private java.util.ArrayList<RBNode <E >>
+inorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the in order traversal, and puts
+ values into an array list.
+
+
+
+void
+insert (E key)
+Inserts a node into the red and black tree.
+
+
+
+private void
+insertCleanUp (RBNode <E > node)
+Implements the red and black tree properties, and ensures the tree be balanced correctly with
+ the correct color for each node.
+
+
+
+RBNode <E >
+insertionPoint (E key)
+Finds the spot of the parent of the node we will be inserting into the tree.
+
+
+
+boolean
+isEmpty ()
+Checks to see if a tree is empty or not.
+
+
+
+boolean
+isLeaf (RBNode <E > node)
+Checks to see if a node is a leaf.
+
+
+
+boolean
+isLeftChild (RBNode <E > node)
+Checks if a node is a left child.
+
+
+
+boolean
+isRightChild (RBNode <E > node)
+Checks if a node is a right child.
+
+
+
+private void
+leftRotate (RBNode <E > node)
+Left rotates the tree to ensure red and black tree properties are fulfilled.
+
+
+
+RBNode <E >
+maxLeftSubtree (RBNode <E > node)
+Finds the max node in the left sub tree of a node.
+
+
+
+RBNode <E >
+nodeToDelete (E key)
+Finds the node that will be deleted.
+
+
+
+int
+numChildren (RBNode <E > node)
+Counts the number of children of a node in the red black tree.
+
+
+
+java.util.ArrayList<RBNode <E >>
+postorder ()
+A helper method for the post order traversal method.
+
+
+
+private java.util.ArrayList<RBNode <E >>
+postorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the post order traversal, and puts
+ values into an array list.
+
+
+
+java.util.ArrayList<RBNode <E >>
+preorder ()
+A helper method for the pre order traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+preorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+
+
+void
+printList (java.util.ArrayList<RBNode <E >> myList)
+Prints an array list.
+
+
+
+private void
+printNodeValue (RBNode <E > node)
+Prints the value in the node.
+
+
+
+void
+printTree ()
+Prints the tree.
+
+
+
+private void
+printTree (RBNode <E > node,
+ boolean isRight,
+ java.lang.String indent)
+Prints the tree
+
+
+
+private void
+rightRotate (RBNode <E > node)
+Right rotates the tree to ensure red and black tree properties are fulfilled.
+
+
+
+(package private) RBNode <E >
+sibling (RBNode <E > node)
+Finds the sibling of a node.
+
+
+
+(package private) RBNode <E >
+uncle (RBNode <E > node)
+Finds the uncle of a node.
+
+
+
+
+
+
+
+Methods inherited from class java.lang.Object
+clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Detail
+
+
+
+
+
+RedBlackTree
+public RedBlackTree()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Method Detail
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+printTree
+public void printTree()
+Prints the tree.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+preorder
+public java.util.ArrayList<RBNode <E >> preorder(RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+Parameters:
+node - the node being sent into method.
+myList - is the array list used to store nodes.
+Returns:
+the array list with the nodes in the appropriate order.
+
+
+
+
+
+
+
+
+
+
+
+
+postorder
+private java.util.ArrayList<RBNode <E >> postorder(RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the post order traversal, and puts
+ values into an array list.
+
+Parameters:
+node - the node being sent into method.
+myList - is the array list used to store nodes.
+Returns:
+the array list with the nodes in the appropriate order.
+
+
+
+
+
+
+
+
+
+
+
+
+inorder
+private java.util.ArrayList<RBNode <E >> inorder(RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the in order traversal, and puts
+ values into an array list.
+
+Parameters:
+node - the node being sent into method.
+myList - is the array list used to store nodes.
+Returns:
+the array list with the nodes in the appropriate order.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+insertCleanUp
+private void insertCleanUp(RBNode <E > node)
+Implements the red and black tree properties, and ensures the tree be balanced correctly with
+ the correct color for each node.
+
+Parameters:
+node - is the node being inserted into the red and black tree.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/RedBlackTree.zip b/Java/Red and Black Tree/doc/rbtree/private/rbtree/RedBlackTree.zip
new file mode 100644
index 0000000..f8b0188
Binary files /dev/null and b/Java/Red and Black Tree/doc/rbtree/private/rbtree/RedBlackTree.zip differ
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/class-use/RBNode.html b/Java/Red and Black Tree/doc/rbtree/private/rbtree/class-use/RBNode.html
new file mode 100644
index 0000000..76632cb
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/rbtree/class-use/RBNode.html
@@ -0,0 +1,436 @@
+
+
+
+
+
+Uses of Class rbtree.RBNode
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Methods in rbtree that return RBNode
+
+Modifier and Type
+Method and Description
+
+
+
+(package private) RBNode <E >
+RedBlackTree. grandparent (RBNode <E > node)
+Finds the grandparent of a node.
+
+
+
+RBNode <E >
+RedBlackTree. insertionPoint (E key)
+Finds the spot of the parent of the node we will be inserting into the tree.
+
+
+
+RBNode <E >
+RedBlackTree. maxLeftSubtree (RBNode <E > node)
+Finds the max node in the left sub tree of a node.
+
+
+
+RBNode <E >
+RedBlackTree. nodeToDelete (E key)
+Finds the node that will be deleted.
+
+
+
+(package private) RBNode <E >
+RedBlackTree. sibling (RBNode <E > node)
+Finds the sibling of a node.
+
+
+
+(package private) RBNode <E >
+RedBlackTree. uncle (RBNode <E > node)
+Finds the uncle of a node.
+
+
+
+
+
+Methods in rbtree that return types with arguments of type RBNode
+
+Modifier and Type
+Method and Description
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. breadthfirst ()
+A helper method for the breadth first traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. breadthfirst (RBNode <E > node)
+Traverses through the red black tree using breadth first algorithm.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. inorder ()
+A helper method for the in order traversal method.
+
+
+
+private java.util.ArrayList<RBNode <E >>
+RedBlackTree. inorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the in order traversal, and puts
+ values into an array list.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. postorder ()
+A helper method for the post order traversal method.
+
+
+
+private java.util.ArrayList<RBNode <E >>
+RedBlackTree. postorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the post order traversal, and puts
+ values into an array list.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. preorder ()
+A helper method for the pre order traversal method.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. preorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+
+
+
+
+Methods in rbtree with parameters of type RBNode
+
+Modifier and Type
+Method and Description
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. breadthfirst (RBNode <E > node)
+Traverses through the red black tree using breadth first algorithm.
+
+
+
+void
+RedBlackTree. delete (RBNode <E > node)
+Deletes the node.
+
+
+
+(package private) RBNode <E >
+RedBlackTree. grandparent (RBNode <E > node)
+Finds the grandparent of a node.
+
+
+
+private java.util.ArrayList<RBNode <E >>
+RedBlackTree. inorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the in order traversal, and puts
+ values into an array list.
+
+
+
+private void
+RedBlackTree. insertCleanUp (RBNode <E > node)
+Implements the red and black tree properties, and ensures the tree be balanced correctly with
+ the correct color for each node.
+
+
+
+boolean
+RedBlackTree. isLeaf (RBNode <E > node)
+Checks to see if a node is a leaf.
+
+
+
+boolean
+RedBlackTree. isLeftChild (RBNode <E > node)
+Checks if a node is a left child.
+
+
+
+boolean
+RedBlackTree. isRightChild (RBNode <E > node)
+Checks if a node is a right child.
+
+
+
+private void
+RedBlackTree. leftRotate (RBNode <E > node)
+Left rotates the tree to ensure red and black tree properties are fulfilled.
+
+
+
+RBNode <E >
+RedBlackTree. maxLeftSubtree (RBNode <E > node)
+Finds the max node in the left sub tree of a node.
+
+
+
+int
+RedBlackTree. numChildren (RBNode <E > node)
+Counts the number of children of a node in the red black tree.
+
+
+
+private java.util.ArrayList<RBNode <E >>
+RedBlackTree. postorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the post order traversal, and puts
+ values into an array list.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. preorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+
+
+private void
+RedBlackTree. printNodeValue (RBNode <E > node)
+Prints the value in the node.
+
+
+
+private void
+RedBlackTree. printTree (RBNode <E > node,
+ boolean isRight,
+ java.lang.String indent)
+Prints the tree
+
+
+
+private void
+RedBlackTree. rightRotate (RBNode <E > node)
+Right rotates the tree to ensure red and black tree properties are fulfilled.
+
+
+
+(package private) RBNode <E >
+RedBlackTree. sibling (RBNode <E > node)
+Finds the sibling of a node.
+
+
+
+(package private) RBNode <E >
+RedBlackTree. uncle (RBNode <E > node)
+Finds the uncle of a node.
+
+
+
+
+
+Method parameters in rbtree with type arguments of type RBNode
+
+Modifier and Type
+Method and Description
+
+
+
+private java.util.ArrayList<RBNode <E >>
+RedBlackTree. inorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the in order traversal, and puts
+ values into an array list.
+
+
+
+private java.util.ArrayList<RBNode <E >>
+RedBlackTree. postorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the post order traversal, and puts
+ values into an array list.
+
+
+
+java.util.ArrayList<RBNode <E >>
+RedBlackTree. preorder (RBNode <E > node,
+ java.util.ArrayList<RBNode <E >> myList)
+Traverses through the red black tree using the pre order traversal, and puts
+ values into an array list.
+
+
+
+void
+RedBlackTree. printList (java.util.ArrayList<RBNode <E >> myList)
+Prints an array list.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/class-use/RedBlackTree.html b/Java/Red and Black Tree/doc/rbtree/private/rbtree/class-use/RedBlackTree.html
new file mode 100644
index 0000000..13ca9e5
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/rbtree/class-use/RedBlackTree.html
@@ -0,0 +1,122 @@
+
+
+
+
+
+Uses of Class rbtree.RedBlackTree
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+No usage of rbtree.RedBlackTree
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-frame.html b/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-frame.html
new file mode 100644
index 0000000..ae502fc
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-frame.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+rbtree
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-summary.html b/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-summary.html
new file mode 100644
index 0000000..8839a85
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-summary.html
@@ -0,0 +1,144 @@
+
+
+
+
+
+rbtree
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Prev Package
+Next Package
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Class Summary
+
+Class
+Description
+
+
+
+RBNode <E extends java.lang.Comparable<E>>
+
+
+
+RedBlackTree <E extends java.lang.Comparable<E>>
+
+
+
+
+
+
+
+
+
+
+
+Prev Package
+Next Package
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-tree.html b/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-tree.html
new file mode 100644
index 0000000..56be0b0
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-tree.html
@@ -0,0 +1,132 @@
+
+
+
+
+
+rbtree Class Hierarchy
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-use.html b/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-use.html
new file mode 100644
index 0000000..d963d56
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/rbtree/package-use.html
@@ -0,0 +1,140 @@
+
+
+
+
+
+Uses of Package rbtree
+
+
+
+
+
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/doc/rbtree/private/script.js b/Java/Red and Black Tree/doc/rbtree/private/script.js
new file mode 100644
index 0000000..b346356
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/script.js
@@ -0,0 +1,30 @@
+function show(type)
+{
+ count = 0;
+ for (var key in methods) {
+ var row = document.getElementById(key);
+ if ((methods[key] & type) != 0) {
+ row.style.display = '';
+ row.className = (count++ % 2) ? rowColor : altColor;
+ }
+ else
+ row.style.display = 'none';
+ }
+ updateTabs(type);
+}
+
+function updateTabs(type)
+{
+ for (var value in tabs) {
+ var sNode = document.getElementById(tabs[value][0]);
+ var spanNode = sNode.firstChild;
+ if (value == type) {
+ sNode.className = activeTableTab;
+ spanNode.innerHTML = tabs[value][1];
+ }
+ else {
+ sNode.className = tableTab;
+ spanNode.innerHTML = "" + tabs[value][1] + " ";
+ }
+ }
+}
diff --git a/Java/Red and Black Tree/doc/rbtree/private/stylesheet.css b/Java/Red and Black Tree/doc/rbtree/private/stylesheet.css
new file mode 100644
index 0000000..98055b2
--- /dev/null
+++ b/Java/Red and Black Tree/doc/rbtree/private/stylesheet.css
@@ -0,0 +1,574 @@
+/* Javadoc style sheet */
+/*
+Overall document style
+*/
+
+@import url('resources/fonts/dejavu.css');
+
+body {
+ background-color:#ffffff;
+ color:#353833;
+ font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;
+ font-size:14px;
+ margin:0;
+}
+a:link, a:visited {
+ text-decoration:none;
+ color:#4A6782;
+}
+a:hover, a:focus {
+ text-decoration:none;
+ color:#bb7a2a;
+}
+a:active {
+ text-decoration:none;
+ color:#4A6782;
+}
+a[name] {
+ color:#353833;
+}
+a[name]:hover {
+ text-decoration:none;
+ color:#353833;
+}
+pre {
+ font-family:'DejaVu Sans Mono', monospace;
+ font-size:14px;
+}
+h1 {
+ font-size:20px;
+}
+h2 {
+ font-size:18px;
+}
+h3 {
+ font-size:16px;
+ font-style:italic;
+}
+h4 {
+ font-size:13px;
+}
+h5 {
+ font-size:12px;
+}
+h6 {
+ font-size:11px;
+}
+ul {
+ list-style-type:disc;
+}
+code, tt {
+ font-family:'DejaVu Sans Mono', monospace;
+ font-size:14px;
+ padding-top:4px;
+ margin-top:8px;
+ line-height:1.4em;
+}
+dt code {
+ font-family:'DejaVu Sans Mono', monospace;
+ font-size:14px;
+ padding-top:4px;
+}
+table tr td dt code {
+ font-family:'DejaVu Sans Mono', monospace;
+ font-size:14px;
+ vertical-align:top;
+ padding-top:4px;
+}
+sup {
+ font-size:8px;
+}
+/*
+Document title and Copyright styles
+*/
+.clear {
+ clear:both;
+ height:0px;
+ overflow:hidden;
+}
+.aboutLanguage {
+ float:right;
+ padding:0px 21px;
+ font-size:11px;
+ z-index:200;
+ margin-top:-9px;
+}
+.legalCopy {
+ margin-left:.5em;
+}
+.bar a, .bar a:link, .bar a:visited, .bar a:active {
+ color:#FFFFFF;
+ text-decoration:none;
+}
+.bar a:hover, .bar a:focus {
+ color:#bb7a2a;
+}
+.tab {
+ background-color:#0066FF;
+ color:#ffffff;
+ padding:8px;
+ width:5em;
+ font-weight:bold;
+}
+/*
+Navigation bar styles
+*/
+.bar {
+ background-color:#4D7A97;
+ color:#FFFFFF;
+ padding:.8em .5em .4em .8em;
+ height:auto;/*height:1.8em;*/
+ font-size:11px;
+ margin:0;
+}
+.topNav {
+ background-color:#4D7A97;
+ color:#FFFFFF;
+ float:left;
+ padding:0;
+ width:100%;
+ clear:right;
+ height:2.8em;
+ padding-top:10px;
+ overflow:hidden;
+ font-size:12px;
+}
+.bottomNav {
+ margin-top:10px;
+ background-color:#4D7A97;
+ color:#FFFFFF;
+ float:left;
+ padding:0;
+ width:100%;
+ clear:right;
+ height:2.8em;
+ padding-top:10px;
+ overflow:hidden;
+ font-size:12px;
+}
+.subNav {
+ background-color:#dee3e9;
+ float:left;
+ width:100%;
+ overflow:hidden;
+ font-size:12px;
+}
+.subNav div {
+ clear:left;
+ float:left;
+ padding:0 0 5px 6px;
+ text-transform:uppercase;
+}
+ul.navList, ul.subNavList {
+ float:left;
+ margin:0 25px 0 0;
+ padding:0;
+}
+ul.navList li{
+ list-style:none;
+ float:left;
+ padding: 5px 6px;
+ text-transform:uppercase;
+}
+ul.subNavList li{
+ list-style:none;
+ float:left;
+}
+.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited {
+ color:#FFFFFF;
+ text-decoration:none;
+ text-transform:uppercase;
+}
+.topNav a:hover, .bottomNav a:hover {
+ text-decoration:none;
+ color:#bb7a2a;
+ text-transform:uppercase;
+}
+.navBarCell1Rev {
+ background-color:#F8981D;
+ color:#253441;
+ margin: auto 5px;
+}
+.skipNav {
+ position:absolute;
+ top:auto;
+ left:-9999px;
+ overflow:hidden;
+}
+/*
+Page header and footer styles
+*/
+.header, .footer {
+ clear:both;
+ margin:0 20px;
+ padding:5px 0 0 0;
+}
+.indexHeader {
+ margin:10px;
+ position:relative;
+}
+.indexHeader span{
+ margin-right:15px;
+}
+.indexHeader h1 {
+ font-size:13px;
+}
+.title {
+ color:#2c4557;
+ margin:10px 0;
+}
+.subTitle {
+ margin:5px 0 0 0;
+}
+.header ul {
+ margin:0 0 15px 0;
+ padding:0;
+}
+.footer ul {
+ margin:20px 0 5px 0;
+}
+.header ul li, .footer ul li {
+ list-style:none;
+ font-size:13px;
+}
+/*
+Heading styles
+*/
+div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
+ background-color:#dee3e9;
+ border:1px solid #d0d9e0;
+ margin:0 0 6px -8px;
+ padding:7px 5px;
+}
+ul.blockList ul.blockList ul.blockList li.blockList h3 {
+ background-color:#dee3e9;
+ border:1px solid #d0d9e0;
+ margin:0 0 6px -8px;
+ padding:7px 5px;
+}
+ul.blockList ul.blockList li.blockList h3 {
+ padding:0;
+ margin:15px 0;
+}
+ul.blockList li.blockList h2 {
+ padding:0px 0 20px 0;
+}
+/*
+Page layout container styles
+*/
+.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
+ clear:both;
+ padding:10px 20px;
+ position:relative;
+}
+.indexContainer {
+ margin:10px;
+ position:relative;
+ font-size:12px;
+}
+.indexContainer h2 {
+ font-size:13px;
+ padding:0 0 3px 0;
+}
+.indexContainer ul {
+ margin:0;
+ padding:0;
+}
+.indexContainer ul li {
+ list-style:none;
+ padding-top:2px;
+}
+.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
+ font-size:12px;
+ font-weight:bold;
+ margin:10px 0 0 0;
+ color:#4E4E4E;
+}
+.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
+ margin:5px 0 10px 0px;
+ font-size:14px;
+ font-family:'DejaVu Sans Mono',monospace;
+}
+.serializedFormContainer dl.nameValue dt {
+ margin-left:1px;
+ font-size:1.1em;
+ display:inline;
+ font-weight:bold;
+}
+.serializedFormContainer dl.nameValue dd {
+ margin:0 0 0 1px;
+ font-size:1.1em;
+ display:inline;
+}
+/*
+List styles
+*/
+ul.horizontal li {
+ display:inline;
+ font-size:0.9em;
+}
+ul.inheritance {
+ margin:0;
+ padding:0;
+}
+ul.inheritance li {
+ display:inline;
+ list-style:none;
+}
+ul.inheritance li ul.inheritance {
+ margin-left:15px;
+ padding-left:15px;
+ padding-top:1px;
+}
+ul.blockList, ul.blockListLast {
+ margin:10px 0 10px 0;
+ padding:0;
+}
+ul.blockList li.blockList, ul.blockListLast li.blockList {
+ list-style:none;
+ margin-bottom:15px;
+ line-height:1.4;
+}
+ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
+ padding:0px 20px 5px 10px;
+ border:1px solid #ededed;
+ background-color:#f8f8f8;
+}
+ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
+ padding:0 0 5px 8px;
+ background-color:#ffffff;
+ border:none;
+}
+ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
+ margin-left:0;
+ padding-left:0;
+ padding-bottom:15px;
+ border:none;
+}
+ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
+ list-style:none;
+ border-bottom:none;
+ padding-bottom:0;
+}
+table tr td dl, table tr td dl dt, table tr td dl dd {
+ margin-top:0;
+ margin-bottom:1px;
+}
+/*
+Table styles
+*/
+.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary {
+ width:100%;
+ border-left:1px solid #EEE;
+ border-right:1px solid #EEE;
+ border-bottom:1px solid #EEE;
+}
+.overviewSummary, .memberSummary {
+ padding:0px;
+}
+.overviewSummary caption, .memberSummary caption, .typeSummary caption,
+.useSummary caption, .constantsSummary caption, .deprecatedSummary caption {
+ position:relative;
+ text-align:left;
+ background-repeat:no-repeat;
+ color:#253441;
+ font-weight:bold;
+ clear:none;
+ overflow:hidden;
+ padding:0px;
+ padding-top:10px;
+ padding-left:1px;
+ margin:0px;
+ white-space:pre;
+}
+.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
+.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link,
+.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
+.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
+.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
+.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active,
+.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
+.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited {
+ color:#FFFFFF;
+}
+.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
+.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {
+ white-space:nowrap;
+ padding-top:5px;
+ padding-left:12px;
+ padding-right:12px;
+ padding-bottom:7px;
+ display:inline-block;
+ float:left;
+ background-color:#F8981D;
+ border: none;
+ height:16px;
+}
+.memberSummary caption span.activeTableTab span {
+ white-space:nowrap;
+ padding-top:5px;
+ padding-left:12px;
+ padding-right:12px;
+ margin-right:3px;
+ display:inline-block;
+ float:left;
+ background-color:#F8981D;
+ height:16px;
+}
+.memberSummary caption span.tableTab span {
+ white-space:nowrap;
+ padding-top:5px;
+ padding-left:12px;
+ padding-right:12px;
+ margin-right:3px;
+ display:inline-block;
+ float:left;
+ background-color:#4D7A97;
+ height:16px;
+}
+.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {
+ padding-top:0px;
+ padding-left:0px;
+ padding-right:0px;
+ background-image:none;
+ float:none;
+ display:inline;
+}
+.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd,
+.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd {
+ display:none;
+ width:5px;
+ position:relative;
+ float:left;
+ background-color:#F8981D;
+}
+.memberSummary .activeTableTab .tabEnd {
+ display:none;
+ width:5px;
+ margin-right:3px;
+ position:relative;
+ float:left;
+ background-color:#F8981D;
+}
+.memberSummary .tableTab .tabEnd {
+ display:none;
+ width:5px;
+ margin-right:3px;
+ position:relative;
+ background-color:#4D7A97;
+ float:left;
+
+}
+.overviewSummary td, .memberSummary td, .typeSummary td,
+.useSummary td, .constantsSummary td, .deprecatedSummary td {
+ text-align:left;
+ padding:0px 0px 12px 10px;
+}
+th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
+td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
+ vertical-align:top;
+ padding-right:0px;
+ padding-top:8px;
+ padding-bottom:3px;
+}
+th.colFirst, th.colLast, th.colOne, .constantsSummary th {
+ background:#dee3e9;
+ text-align:left;
+ padding:8px 3px 3px 7px;
+}
+td.colFirst, th.colFirst {
+ white-space:nowrap;
+ font-size:13px;
+}
+td.colLast, th.colLast {
+ font-size:13px;
+}
+td.colOne, th.colOne {
+ font-size:13px;
+}
+.overviewSummary td.colFirst, .overviewSummary th.colFirst,
+.useSummary td.colFirst, .useSummary th.colFirst,
+.overviewSummary td.colOne, .overviewSummary th.colOne,
+.memberSummary td.colFirst, .memberSummary th.colFirst,
+.memberSummary td.colOne, .memberSummary th.colOne,
+.typeSummary td.colFirst{
+ width:25%;
+ vertical-align:top;
+}
+td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
+ font-weight:bold;
+}
+.tableSubHeadingColor {
+ background-color:#EEEEFF;
+}
+.altColor {
+ background-color:#FFFFFF;
+}
+.rowColor {
+ background-color:#EEEEEF;
+}
+/*
+Content styles
+*/
+.description pre {
+ margin-top:0;
+}
+.deprecatedContent {
+ margin:0;
+ padding:10px 0;
+}
+.docSummary {
+ padding:0;
+}
+
+ul.blockList ul.blockList ul.blockList li.blockList h3 {
+ font-style:normal;
+}
+
+div.block {
+ font-size:14px;
+ font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
+}
+
+td.colLast div {
+ padding-top:0px;
+}
+
+
+td.colLast a {
+ padding-bottom:3px;
+}
+/*
+Formatting effect styles
+*/
+.sourceLineNo {
+ color:green;
+ padding:0 30px 0 0;
+}
+h1.hidden {
+ visibility:hidden;
+ overflow:hidden;
+ font-size:10px;
+}
+.block {
+ display:block;
+ margin:3px 10px 2px 0px;
+ color:#474747;
+}
+.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink,
+.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel,
+.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink {
+ font-weight:bold;
+}
+.deprecationComment, .emphasizedPhrase, .interfaceName {
+ font-style:italic;
+}
+
+div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
+div.block div.block span.interfaceName {
+ font-style:normal;
+}
+
+div.contentContainer ul.blockList li.blockList h2{
+ padding-bottom:0px;
+}
diff --git a/Java/Red and Black Tree/doc/script.js b/Java/Red and Black Tree/doc/script.js
new file mode 100644
index 0000000..b346356
--- /dev/null
+++ b/Java/Red and Black Tree/doc/script.js
@@ -0,0 +1,30 @@
+function show(type)
+{
+ count = 0;
+ for (var key in methods) {
+ var row = document.getElementById(key);
+ if ((methods[key] & type) != 0) {
+ row.style.display = '';
+ row.className = (count++ % 2) ? rowColor : altColor;
+ }
+ else
+ row.style.display = 'none';
+ }
+ updateTabs(type);
+}
+
+function updateTabs(type)
+{
+ for (var value in tabs) {
+ var sNode = document.getElementById(tabs[value][0]);
+ var spanNode = sNode.firstChild;
+ if (value == type) {
+ sNode.className = activeTableTab;
+ spanNode.innerHTML = tabs[value][1];
+ }
+ else {
+ sNode.className = tableTab;
+ spanNode.innerHTML = "" + tabs[value][1] + " ";
+ }
+ }
+}
diff --git a/Java/Red and Black Tree/doc/stylesheet.css b/Java/Red and Black Tree/doc/stylesheet.css
new file mode 100644
index 0000000..98055b2
--- /dev/null
+++ b/Java/Red and Black Tree/doc/stylesheet.css
@@ -0,0 +1,574 @@
+/* Javadoc style sheet */
+/*
+Overall document style
+*/
+
+@import url('resources/fonts/dejavu.css');
+
+body {
+ background-color:#ffffff;
+ color:#353833;
+ font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;
+ font-size:14px;
+ margin:0;
+}
+a:link, a:visited {
+ text-decoration:none;
+ color:#4A6782;
+}
+a:hover, a:focus {
+ text-decoration:none;
+ color:#bb7a2a;
+}
+a:active {
+ text-decoration:none;
+ color:#4A6782;
+}
+a[name] {
+ color:#353833;
+}
+a[name]:hover {
+ text-decoration:none;
+ color:#353833;
+}
+pre {
+ font-family:'DejaVu Sans Mono', monospace;
+ font-size:14px;
+}
+h1 {
+ font-size:20px;
+}
+h2 {
+ font-size:18px;
+}
+h3 {
+ font-size:16px;
+ font-style:italic;
+}
+h4 {
+ font-size:13px;
+}
+h5 {
+ font-size:12px;
+}
+h6 {
+ font-size:11px;
+}
+ul {
+ list-style-type:disc;
+}
+code, tt {
+ font-family:'DejaVu Sans Mono', monospace;
+ font-size:14px;
+ padding-top:4px;
+ margin-top:8px;
+ line-height:1.4em;
+}
+dt code {
+ font-family:'DejaVu Sans Mono', monospace;
+ font-size:14px;
+ padding-top:4px;
+}
+table tr td dt code {
+ font-family:'DejaVu Sans Mono', monospace;
+ font-size:14px;
+ vertical-align:top;
+ padding-top:4px;
+}
+sup {
+ font-size:8px;
+}
+/*
+Document title and Copyright styles
+*/
+.clear {
+ clear:both;
+ height:0px;
+ overflow:hidden;
+}
+.aboutLanguage {
+ float:right;
+ padding:0px 21px;
+ font-size:11px;
+ z-index:200;
+ margin-top:-9px;
+}
+.legalCopy {
+ margin-left:.5em;
+}
+.bar a, .bar a:link, .bar a:visited, .bar a:active {
+ color:#FFFFFF;
+ text-decoration:none;
+}
+.bar a:hover, .bar a:focus {
+ color:#bb7a2a;
+}
+.tab {
+ background-color:#0066FF;
+ color:#ffffff;
+ padding:8px;
+ width:5em;
+ font-weight:bold;
+}
+/*
+Navigation bar styles
+*/
+.bar {
+ background-color:#4D7A97;
+ color:#FFFFFF;
+ padding:.8em .5em .4em .8em;
+ height:auto;/*height:1.8em;*/
+ font-size:11px;
+ margin:0;
+}
+.topNav {
+ background-color:#4D7A97;
+ color:#FFFFFF;
+ float:left;
+ padding:0;
+ width:100%;
+ clear:right;
+ height:2.8em;
+ padding-top:10px;
+ overflow:hidden;
+ font-size:12px;
+}
+.bottomNav {
+ margin-top:10px;
+ background-color:#4D7A97;
+ color:#FFFFFF;
+ float:left;
+ padding:0;
+ width:100%;
+ clear:right;
+ height:2.8em;
+ padding-top:10px;
+ overflow:hidden;
+ font-size:12px;
+}
+.subNav {
+ background-color:#dee3e9;
+ float:left;
+ width:100%;
+ overflow:hidden;
+ font-size:12px;
+}
+.subNav div {
+ clear:left;
+ float:left;
+ padding:0 0 5px 6px;
+ text-transform:uppercase;
+}
+ul.navList, ul.subNavList {
+ float:left;
+ margin:0 25px 0 0;
+ padding:0;
+}
+ul.navList li{
+ list-style:none;
+ float:left;
+ padding: 5px 6px;
+ text-transform:uppercase;
+}
+ul.subNavList li{
+ list-style:none;
+ float:left;
+}
+.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited {
+ color:#FFFFFF;
+ text-decoration:none;
+ text-transform:uppercase;
+}
+.topNav a:hover, .bottomNav a:hover {
+ text-decoration:none;
+ color:#bb7a2a;
+ text-transform:uppercase;
+}
+.navBarCell1Rev {
+ background-color:#F8981D;
+ color:#253441;
+ margin: auto 5px;
+}
+.skipNav {
+ position:absolute;
+ top:auto;
+ left:-9999px;
+ overflow:hidden;
+}
+/*
+Page header and footer styles
+*/
+.header, .footer {
+ clear:both;
+ margin:0 20px;
+ padding:5px 0 0 0;
+}
+.indexHeader {
+ margin:10px;
+ position:relative;
+}
+.indexHeader span{
+ margin-right:15px;
+}
+.indexHeader h1 {
+ font-size:13px;
+}
+.title {
+ color:#2c4557;
+ margin:10px 0;
+}
+.subTitle {
+ margin:5px 0 0 0;
+}
+.header ul {
+ margin:0 0 15px 0;
+ padding:0;
+}
+.footer ul {
+ margin:20px 0 5px 0;
+}
+.header ul li, .footer ul li {
+ list-style:none;
+ font-size:13px;
+}
+/*
+Heading styles
+*/
+div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
+ background-color:#dee3e9;
+ border:1px solid #d0d9e0;
+ margin:0 0 6px -8px;
+ padding:7px 5px;
+}
+ul.blockList ul.blockList ul.blockList li.blockList h3 {
+ background-color:#dee3e9;
+ border:1px solid #d0d9e0;
+ margin:0 0 6px -8px;
+ padding:7px 5px;
+}
+ul.blockList ul.blockList li.blockList h3 {
+ padding:0;
+ margin:15px 0;
+}
+ul.blockList li.blockList h2 {
+ padding:0px 0 20px 0;
+}
+/*
+Page layout container styles
+*/
+.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
+ clear:both;
+ padding:10px 20px;
+ position:relative;
+}
+.indexContainer {
+ margin:10px;
+ position:relative;
+ font-size:12px;
+}
+.indexContainer h2 {
+ font-size:13px;
+ padding:0 0 3px 0;
+}
+.indexContainer ul {
+ margin:0;
+ padding:0;
+}
+.indexContainer ul li {
+ list-style:none;
+ padding-top:2px;
+}
+.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
+ font-size:12px;
+ font-weight:bold;
+ margin:10px 0 0 0;
+ color:#4E4E4E;
+}
+.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
+ margin:5px 0 10px 0px;
+ font-size:14px;
+ font-family:'DejaVu Sans Mono',monospace;
+}
+.serializedFormContainer dl.nameValue dt {
+ margin-left:1px;
+ font-size:1.1em;
+ display:inline;
+ font-weight:bold;
+}
+.serializedFormContainer dl.nameValue dd {
+ margin:0 0 0 1px;
+ font-size:1.1em;
+ display:inline;
+}
+/*
+List styles
+*/
+ul.horizontal li {
+ display:inline;
+ font-size:0.9em;
+}
+ul.inheritance {
+ margin:0;
+ padding:0;
+}
+ul.inheritance li {
+ display:inline;
+ list-style:none;
+}
+ul.inheritance li ul.inheritance {
+ margin-left:15px;
+ padding-left:15px;
+ padding-top:1px;
+}
+ul.blockList, ul.blockListLast {
+ margin:10px 0 10px 0;
+ padding:0;
+}
+ul.blockList li.blockList, ul.blockListLast li.blockList {
+ list-style:none;
+ margin-bottom:15px;
+ line-height:1.4;
+}
+ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
+ padding:0px 20px 5px 10px;
+ border:1px solid #ededed;
+ background-color:#f8f8f8;
+}
+ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
+ padding:0 0 5px 8px;
+ background-color:#ffffff;
+ border:none;
+}
+ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
+ margin-left:0;
+ padding-left:0;
+ padding-bottom:15px;
+ border:none;
+}
+ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
+ list-style:none;
+ border-bottom:none;
+ padding-bottom:0;
+}
+table tr td dl, table tr td dl dt, table tr td dl dd {
+ margin-top:0;
+ margin-bottom:1px;
+}
+/*
+Table styles
+*/
+.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary {
+ width:100%;
+ border-left:1px solid #EEE;
+ border-right:1px solid #EEE;
+ border-bottom:1px solid #EEE;
+}
+.overviewSummary, .memberSummary {
+ padding:0px;
+}
+.overviewSummary caption, .memberSummary caption, .typeSummary caption,
+.useSummary caption, .constantsSummary caption, .deprecatedSummary caption {
+ position:relative;
+ text-align:left;
+ background-repeat:no-repeat;
+ color:#253441;
+ font-weight:bold;
+ clear:none;
+ overflow:hidden;
+ padding:0px;
+ padding-top:10px;
+ padding-left:1px;
+ margin:0px;
+ white-space:pre;
+}
+.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
+.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link,
+.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
+.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
+.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
+.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active,
+.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
+.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited {
+ color:#FFFFFF;
+}
+.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
+.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {
+ white-space:nowrap;
+ padding-top:5px;
+ padding-left:12px;
+ padding-right:12px;
+ padding-bottom:7px;
+ display:inline-block;
+ float:left;
+ background-color:#F8981D;
+ border: none;
+ height:16px;
+}
+.memberSummary caption span.activeTableTab span {
+ white-space:nowrap;
+ padding-top:5px;
+ padding-left:12px;
+ padding-right:12px;
+ margin-right:3px;
+ display:inline-block;
+ float:left;
+ background-color:#F8981D;
+ height:16px;
+}
+.memberSummary caption span.tableTab span {
+ white-space:nowrap;
+ padding-top:5px;
+ padding-left:12px;
+ padding-right:12px;
+ margin-right:3px;
+ display:inline-block;
+ float:left;
+ background-color:#4D7A97;
+ height:16px;
+}
+.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {
+ padding-top:0px;
+ padding-left:0px;
+ padding-right:0px;
+ background-image:none;
+ float:none;
+ display:inline;
+}
+.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd,
+.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd {
+ display:none;
+ width:5px;
+ position:relative;
+ float:left;
+ background-color:#F8981D;
+}
+.memberSummary .activeTableTab .tabEnd {
+ display:none;
+ width:5px;
+ margin-right:3px;
+ position:relative;
+ float:left;
+ background-color:#F8981D;
+}
+.memberSummary .tableTab .tabEnd {
+ display:none;
+ width:5px;
+ margin-right:3px;
+ position:relative;
+ background-color:#4D7A97;
+ float:left;
+
+}
+.overviewSummary td, .memberSummary td, .typeSummary td,
+.useSummary td, .constantsSummary td, .deprecatedSummary td {
+ text-align:left;
+ padding:0px 0px 12px 10px;
+}
+th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
+td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
+ vertical-align:top;
+ padding-right:0px;
+ padding-top:8px;
+ padding-bottom:3px;
+}
+th.colFirst, th.colLast, th.colOne, .constantsSummary th {
+ background:#dee3e9;
+ text-align:left;
+ padding:8px 3px 3px 7px;
+}
+td.colFirst, th.colFirst {
+ white-space:nowrap;
+ font-size:13px;
+}
+td.colLast, th.colLast {
+ font-size:13px;
+}
+td.colOne, th.colOne {
+ font-size:13px;
+}
+.overviewSummary td.colFirst, .overviewSummary th.colFirst,
+.useSummary td.colFirst, .useSummary th.colFirst,
+.overviewSummary td.colOne, .overviewSummary th.colOne,
+.memberSummary td.colFirst, .memberSummary th.colFirst,
+.memberSummary td.colOne, .memberSummary th.colOne,
+.typeSummary td.colFirst{
+ width:25%;
+ vertical-align:top;
+}
+td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
+ font-weight:bold;
+}
+.tableSubHeadingColor {
+ background-color:#EEEEFF;
+}
+.altColor {
+ background-color:#FFFFFF;
+}
+.rowColor {
+ background-color:#EEEEEF;
+}
+/*
+Content styles
+*/
+.description pre {
+ margin-top:0;
+}
+.deprecatedContent {
+ margin:0;
+ padding:10px 0;
+}
+.docSummary {
+ padding:0;
+}
+
+ul.blockList ul.blockList ul.blockList li.blockList h3 {
+ font-style:normal;
+}
+
+div.block {
+ font-size:14px;
+ font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
+}
+
+td.colLast div {
+ padding-top:0px;
+}
+
+
+td.colLast a {
+ padding-bottom:3px;
+}
+/*
+Formatting effect styles
+*/
+.sourceLineNo {
+ color:green;
+ padding:0 30px 0 0;
+}
+h1.hidden {
+ visibility:hidden;
+ overflow:hidden;
+ font-size:10px;
+}
+.block {
+ display:block;
+ margin:3px 10px 2px 0px;
+ color:#474747;
+}
+.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink,
+.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel,
+.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink {
+ font-weight:bold;
+}
+.deprecationComment, .emphasizedPhrase, .interfaceName {
+ font-style:italic;
+}
+
+div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
+div.block div.block span.interfaceName {
+ font-style:normal;
+}
+
+div.contentContainer ul.blockList li.blockList h2{
+ padding-bottom:0px;
+}
diff --git a/Java/Red and Black Tree/src/.classpath b/Java/Red and Black Tree/src/.classpath
new file mode 100644
index 0000000..3b2e843
--- /dev/null
+++ b/Java/Red and Black Tree/src/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Java/Red and Black Tree/src/application/application.css b/Java/Red and Black Tree/src/application/application.css
new file mode 100644
index 0000000..83d6f33
--- /dev/null
+++ b/Java/Red and Black Tree/src/application/application.css
@@ -0,0 +1 @@
+/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */
\ No newline at end of file
diff --git a/Java/Red and Black Tree/src/rbtree/Main.java b/Java/Red and Black Tree/src/rbtree/Main.java
new file mode 100644
index 0000000..b892280
--- /dev/null
+++ b/Java/Red and Black Tree/src/rbtree/Main.java
@@ -0,0 +1,64 @@
+package rbtree;
+
+import javafx.application.Application;
+import javafx.stage.Stage;
+import rbtree.RedBlackTree;
+import javafx.scene.Scene;
+import javafx.scene.layout.BorderPane;
+
+public class Main extends Application {
+ @Override
+ public void start(Stage primaryStage) {
+ try {
+ BorderPane root = new BorderPane();
+ Scene scene = new Scene(root, 400, 400);
+ scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
+ primaryStage.setScene(scene);
+ primaryStage.show();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) {
+ // launch(args);
+
+
+ //TEST1
+ Integer[] myArray1 = { 53,90,92,62,75,38,70,36,52,32 };
+ RedBlackTree one = new RedBlackTree<>(myArray1);
+ System.out.println("Tree One : ");
+ System.out.println();
+ one.printTree();
+ System.out.println();
+
+ /*
+ //TEST2
+ System.out.println();
+ Integer[] myArray2 = { 10, 20, -10, 15, 17, 40,50,60 };
+ RedBlackTree two = new RedBlackTree<>(myArray2);
+ System.out.println("Tree Two : ");
+ System.out.println();
+ two.printTree();
+ System.out.println();
+
+ //TEST3
+ System.out.println();
+ Integer[] myArray3 = { 4, 5, 1,3,2 };
+ RedBlackTree three = new RedBlackTree<>(myArray3);
+ System.out.println("Tree Three : ");
+ System.out.println();
+ three.printTree();
+ System.out.println();
+
+
+ //TEST4
+ System.out.println();
+ Integer[] myArray4 = { 1,2,3,4,5};
+ RedBlackTree four = new RedBlackTree<>(myArray4);
+ System.out.println("Tree Four : ");
+ System.out.println();
+ four.printTree();
+ System.out.println();*/
+ }
+}
diff --git a/Java/Red and Black Tree/src/rbtree/RBNode.java b/Java/Red and Black Tree/src/rbtree/RBNode.java
new file mode 100644
index 0000000..83664c0
--- /dev/null
+++ b/Java/Red and Black Tree/src/rbtree/RBNode.java
@@ -0,0 +1,36 @@
+package rbtree;
+
+public class RBNode> {
+
+ protected RBNode parent;
+ protected RBNode left;
+ protected RBNode right;
+
+ protected String color;//B is black, DB is double black, R is red.
+
+ protected E data;
+
+ /**
+ * Creates an RBNode.
+ * @param data is the data that is stored in the given node.
+ */
+
+ public RBNode(E data) {
+ this.data = data;
+ }
+
+ /**
+ * A setter for the node.
+ * @param data is the value that will be set into the node.
+ */
+ public void setData(E data) {
+ this.data=data;
+ }
+ /**
+ * A getter for the value inside the node.
+ * @return the data in the node.
+ */
+ public E getData() {
+ return this.data;
+ }
+}
diff --git a/Java/Red and Black Tree/src/rbtree/RedBlackTree.java b/Java/Red and Black Tree/src/rbtree/RedBlackTree.java
new file mode 100644
index 0000000..6c6f4fd
--- /dev/null
+++ b/Java/Red and Black Tree/src/rbtree/RedBlackTree.java
@@ -0,0 +1,886 @@
+package rbtree;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.Queue;
+
+//import tree.BSTNode;
+
+//import tree.RBNode;
+
+public class RedBlackTree> {
+
+ private RBNode root;
+ private RBNode NIL;
+
+ public RedBlackTree() {
+ this.root = null;
+ }
+
+ public RedBlackTree(E[] myArray) {
+
+ this.root = new RBNode(myArray[0]);
+ insertCleanUp(root);
+ RBNode current = root;
+ RBNode temp = current;
+
+ for (int i = 0; i < myArray.length; i++) {
+
+ if (i == 0) {
+ current.data = myArray[i];
+ current.parent = null;
+ }
+
+ else {
+ insert(myArray[i]);
+ }
+
+ }
+ }
+
+ /**
+ * Finds the spot of the parent of the node we will be inserting into the tree.
+ *
+ * @param key
+ * is the data inside the node.
+ * @return the parent of the new node we are going to insert.
+ */
+ public RBNode insertionPoint(E key) {
+
+ RBNode current = root;
+
+ RBNode parent = null;
+
+ RBNode temp = current;
+
+ while (current != null) {
+ if (key.compareTo(current.data) == 0) { // throw
+ // DuplicateItemException
+ }
+
+ else if (key.compareTo(current.data) < 0) {
+
+ // key 0) {
+
+ // key>current.data
+
+ parent = current;
+ current = current.right;
+
+ }
+
+ }
+
+ return parent;
+
+ }
+
+ /**
+ * Inserts a node into the red and black tree.
+ *
+ * @param key
+ * is the data which will be inside of the new node.
+ */
+
+ public void insert(E key) {
+
+ RBNode child = new RBNode(key);
+ child.left = NIL;
+ child.right = NIL;
+
+ if (root == null) {
+ insertCleanUp(child);
+ root = child;
+ } else {
+
+ if (!find(key)) {
+
+ child.parent = insertionPoint(key);
+
+ if (key.compareTo(child.parent.data) < 0) {
+ child.parent.left = child;
+ } else if (key.compareTo(child.parent.data) > 0) {
+ child.parent.right = child;
+ }
+
+ }
+ insertCleanUp(child);
+ }
+ }
+
+ /**
+ * Finds if the data exists in red black tree based off of parameter.
+ *
+ * @param key
+ * is the data being searched in the tree.
+ * @return true if key is found, and false if it is not found.
+ */
+
+ public boolean find(E key) {
+
+ RBNode current = this.root;
+
+ while (current != null) {
+
+ if (key.compareTo(current.data) == 0) {
+ return true;
+ }
+
+ else if (key.compareTo(current.data) < 0) {
+
+ current = current.left;
+ }
+
+ else if (key.compareTo(current.data) > 0) {
+
+ current = current.right;
+ }
+
+ // System.out.println(current);
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks to see if a tree is empty or not.
+ *
+ * @return true if tree is empty. False if tree is not empty.
+ */
+ public boolean isEmpty() {
+ if (root == null) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks to see if a node is a leaf.
+ *
+ * @param node
+ * is the node we are checking.
+ * @return true if the node is a leaf, and false if it is not a leaf.
+ */
+
+ public boolean isLeaf(RBNode node) {
+
+ if (node.right == null && node.left == null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Prints the tree.
+ */
+ public void printTree() {
+
+ if (this.root.right != null) {
+ this.printTree(this.root.right, true, "");
+ }
+
+ printNodeValue(this.root);
+
+ if (this.root.left != null) {
+ this.printTree(this.root.left, false, "");
+ }
+ }
+
+ /**
+ * Prints the tree
+ *
+ * @param node
+ * is the current node.
+ * @param isRight
+ * boolean for if it is right.
+ * @param indent
+ */
+ private void printTree(RBNode node, boolean isRight, String indent) {
+ if (node.right != null) {
+ printTree(node.right, true, indent + (isRight ? " " : " | "));
+ }
+
+ System.out.print(indent);
+
+ if (isRight) {
+ System.out.print(" /");
+ } else {
+ System.out.print(" \\");
+ }
+ System.out.print("----- ");
+ printNodeValue(node);
+ if (node.left != null) {
+ printTree(node.left, false, indent + (isRight ? " | " : " "));
+ }
+
+ }
+
+ /**
+ * Prints the value in the node.
+ *
+ * @param node
+ * the current node.
+ */
+
+ private void printNodeValue(RBNode node) {
+ if (node == null) {
+ System.out.print("");
+ } else {
+ System.out.print(node.getData() + "(" + node.color + ")");
+ }
+
+ System.out.println();
+ }
+
+ /**
+ * Counts the number of children of a node in the red black tree.
+ *
+ * @param node
+ * is the node we are checking.
+ * @return the count of the number of children that the node has.
+ */
+
+ public int numChildren(RBNode node) {
+ int count = 0;
+
+ if (node.left != null) {
+ count++;
+ }
+ if (node.right != null) {
+ count++;
+ }
+ return count;
+
+ }
+
+ /**
+ * Finds the node that will be deleted.
+ *
+ * @param key
+ * is the data inside that node.
+ * @return the node if it exists, and null if it does not.
+ */
+ public RBNode nodeToDelete(E key) {
+
+ if (find(key)) {
+ RBNode current = root;
+
+ while (current != null) {
+
+ if (key.compareTo(current.data) == 0) {
+
+ return current;
+ } else if (key.compareTo(current.data) < 0) {
+
+ current = current.left;
+ } else if (key.compareTo(current.data) > 0) {
+ current = current.right;
+ }
+
+ }
+ }
+ return null;
+ }
+
+ /**
+ * A helper method to delete a node.
+ *
+ * @param key
+ * is the value of the node that is going to be deleted.
+ */
+ public void delete(E key) {
+
+ if (find(key)) {
+ RBNode removing = nodeToDelete(key);
+ delete(removing);
+ }
+ }
+
+ /**
+ * Deletes the node.
+ *
+ * @param node
+ * is the node that is going to be deleted.
+ */
+
+ public void delete(RBNode node) {
+
+ RBNode child = null;
+
+ if (isLeaf(node)) {
+ if (isLeftChild(node)) {
+ node.parent.left = null;
+
+ } else if (isRightChild(node)) {
+ node.parent.right = null;
+
+ }
+ } else if (numChildren(node) == 1) {
+
+ if (node.left == null) {
+ child = node.right;
+ } else if (node.right == null) {
+ child = node.left;
+ }
+
+ if (isLeftChild(node)) {
+ node.parent.left = child;
+ child.parent = node.parent;
+ } else if (isRightChild(node)) {
+ node.parent.right = child;
+ child.parent = node.parent;
+ }
+
+ }
+
+ else if (numChildren(node) == 2) {
+
+ RBNode max = maxLeftSubtree(node);
+
+ node.setData(max.getData());
+ delete(max);
+
+ }
+
+ }
+
+ /**
+ * Finds the max node in the left sub tree of a node.
+ *
+ * @param node
+ * is the node we are checking.
+ * @return the max node in the left sub tree.
+ */
+ public RBNode maxLeftSubtree(RBNode node) {
+
+ RBNode current = node.left;
+
+ if (current != null) {
+ while (current.right != null) {
+ current = current.right;
+ }
+
+ return current;
+
+ }
+
+ return current;
+ }
+
+ /**
+ * Finds the sibling of a node.
+ *
+ * @param node
+ * is the node that we are trying to find the sibling of.
+ * @return the sibling of a node.
+ */
+ RBNode sibling(RBNode node) {
+
+ if (find(node.getData())) {
+
+ if (isRightChild(node) && node.parent.left != null) {
+ return node.parent.left;
+ }
+
+ else if (isLeftChild(node) && node.parent.right != null) {
+ return node.parent.right;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Finds the uncle of a node.
+ *
+ * @param node
+ * is the node that we are trying to find the uncle of.
+ * @return the uncle of a node.
+ */
+ RBNode uncle(RBNode node) {
+
+ if (node.parent != null) {
+ return sibling(node.parent);
+ }
+
+ return null;
+ }
+
+ /**
+ * Finds the grandparent of a node.
+ *
+ * @param node
+ * is the node that we are trying to find the grandparent of.
+ * @return the grandparent of a node.
+ */
+ RBNode grandparent(RBNode node) {
+
+ if (node.parent != null && (isLeftChild(node.parent) || isRightChild(node.parent))) {
+
+ return node.parent.parent;
+
+ }
+
+ return null;
+ }
+
+ /**
+ * Checks if a node is a left child.
+ *
+ * @param node
+ * is the node we are checking.
+ * @return true if the node is a left child, and false if it is not a left
+ * child.
+ */
+
+ public boolean isLeftChild(RBNode node) {
+
+ if (node.parent == null) {
+ return false;
+ } else if (node.parent.left == null) {
+ return false;
+ }
+
+ return node.parent.left.data.equals(node.data);
+ }
+
+ /**
+ * Checks if a node is a right child.
+ *
+ * @param node
+ * is the node we are checking.
+ * @return true if the node is a right child, and false if it is not a right
+ * child.
+ */
+
+ public boolean isRightChild(RBNode node) {
+
+ if (node.parent == null) {
+ return false;
+ }
+
+ else if (node.parent.right == null) {
+ return false;
+ }
+
+ return node.parent.right.data.equals(node.data);
+ }
+
+ /**
+ * A helper method for the pre order traversal method.
+ *
+ * @return an array list with the correct traversal.
+ */
+
+ public ArrayList> preorder() {
+ ArrayList> myList = new ArrayList<>();
+
+ myList = preorder(root, myList);
+ return myList;
+ }
+
+ /**
+ * Traverses through the red black tree using the pre order traversal, and puts
+ * values into an array list.
+ *
+ * @param node
+ * the node being sent into method.
+ * @param myList
+ * is the array list used to store nodes.
+ * @return the array list with the nodes in the appropriate order.
+ */
+
+ public ArrayList> preorder(RBNode node, ArrayList> myList) {
+
+ if (node == null) {
+ return myList;
+ }
+
+ myList.add(node);
+
+ preorder(node.left, myList);
+ preorder(node.right, myList);
+
+ return myList;
+
+ }
+
+ /**
+ * A helper method for the post order traversal method.
+ *
+ * @return an array list with the correct traversal.
+ */
+
+ public ArrayList> postorder() {
+ ArrayList> myList = new ArrayList<>();
+
+ myList = postorder(root, myList);
+ return myList;
+ }
+
+ /**
+ * Traverses through the red black tree using the post order traversal, and puts
+ * values into an array list.
+ *
+ * @param node
+ * the node being sent into method.
+ * @param myList
+ * is the array list used to store nodes.
+ * @return the array list with the nodes in the appropriate order.
+ */
+
+ private ArrayList> postorder(RBNode node, ArrayList> myList) {
+
+ if (node == null) {
+ return myList;
+ }
+
+ postorder(node.left, myList);
+ postorder(node.right, myList);
+ // System.out.println(node.getData());
+
+ myList.add(node);
+
+ return myList;
+ }
+
+ /**
+ * A helper method for the in order traversal method.
+ *
+ * @return an array list with the correct traversal.
+ */
+
+ public ArrayList> inorder() {
+ ArrayList> myList = new ArrayList<>();
+
+ myList = inorder(this.root, myList);
+ return myList;
+ }
+
+ /**
+ * Traverses through the red black tree using the in order traversal, and puts
+ * values into an array list.
+ *
+ * @param node
+ * the node being sent into method.
+ * @param myList
+ * is the array list used to store nodes.
+ * @return the array list with the nodes in the appropriate order.
+ */
+
+ private ArrayList> inorder(RBNode node, ArrayList> myList) {
+
+ if (node == null) {
+ return myList;
+ }
+
+ inorder(node.left, myList);
+
+ myList.add(node);
+ // System.out.println(node.getData() + " size " + myList.size());
+
+ inorder(node.right, myList);
+ ;
+ return myList;
+ }
+
+ /**
+ * A helper method for the breadth first traversal method.
+ *
+ * @return an array list with the correct traversal.
+ */
+
+ public ArrayList> breadthfirst() {
+
+ ArrayList> myList = new ArrayList<>();
+
+ myList = breadthfirst(root);
+ return myList;
+ }
+
+ /**
+ * Traverses through the red black tree using breadth first algorithm. Inputs
+ * into an array list accordingly.
+ *
+ * @param node
+ * is the root of the red black tree.
+ * @return an array list of nodes.
+ */
+
+ public ArrayList> breadthfirst(RBNode node) {
+
+ ArrayList> myList = new ArrayList<>();
+ Queue> Q = new LinkedList>();
+
+ Q.add(root);
+
+ while (!Q.isEmpty()) {
+ node = Q.remove();
+ myList.add(node);
+ System.out.println("data : " + node.getData());
+
+ if (node.left != null) {
+ Q.add(node.left);
+ }
+ if (node.right != null) {
+ Q.add(node.right);
+ }
+ }
+
+ return myList;
+ }
+
+ /**
+ * Prints an array list.
+ *
+ * @param myList
+ * the list of RBNode that is going to be printed.
+ */
+
+ public void printList(ArrayList> myList) {
+
+ for (int i = 0; i < myList.size(); i++) {
+
+ System.out.print(" [ " + myList.get(i).getData() + " ]");
+ }
+
+ }
+
+ /**
+ * Implements the red and black tree properties, and ensures the tree be balanced correctly with
+ * the correct color for each node.
+ * @param node is the node being inserted into the red and black tree.
+ */
+
+ private void insertCleanUp(RBNode node) {
+
+ // case 1:
+ if (node == root) {
+ node.color = "Black";
+ return;
+ } else {
+ node.color = "Red";
+ }
+
+ // case 2:
+
+ if (node.parent.color == "Black") {
+ return;
+ }
+
+ // case 3:
+
+ if (node.parent.color == "Red" && uncle(node) != null) {
+
+ if (uncle(node).color == "Red") {
+
+ node.parent.color = "Black";
+ uncle(node).color = "Black";
+ grandparent(node).color = "Red";
+ insertCleanUp(grandparent(node));
+ }
+ }
+
+ // case 4:
+
+ if (node.parent.color == "Red" && (uncle(node) == null || uncle(node).color == "Black")) {
+ if (isRightChild(node) && isLeftChild(node.parent)) { // case 4ab
+
+ RBNode temp = node;
+ RBNode tempParent = node.parent;
+
+ leftRotate(node);
+
+ node = tempParent;
+ node.parent = temp;
+
+ }
+ if (isLeftChild(node) && isRightChild(node.parent)) {
+
+ RBNode temp = node;
+ RBNode tempParent = node.parent;
+
+ rightRotate(node);
+
+ node = tempParent;
+ node.parent = temp;
+
+ }
+ }
+
+ // case 5 :
+ if (node.parent.color == "Red" && (uncle(node) == null || uncle(node).color == "Black")) {
+
+ if (isLeftChild(node) && isLeftChild(node.parent)) {// case 5ab
+
+ grandparent(node).color = "Red";
+ node.parent.color = "Black";
+
+ RBNode temp = node;
+ rightRotate(node);
+
+ node = node.parent;
+
+ }
+ if (isRightChild(node) && isRightChild(node.parent)) {
+
+ grandparent(node).color = "Red";
+ node.parent.color = "Black";
+
+ leftRotate(node);
+ }
+ }
+
+ }
+
+ /**
+ * Left rotates the tree to ensure red and black tree properties are fulfilled.
+ * @param node is the node used as a pivot.
+ */
+
+ private void leftRotate(RBNode node) {
+
+ RBNode temp = node;
+ RBNode tempParent = node.parent;
+ RBNode tempGrandParent = grandparent(node);
+
+ RBNode tempLeft = tempParent.left;
+
+ if (node.parent.parent == null) {
+
+ root = temp;
+ tempParent.right = null;
+ root.left = tempParent;
+
+ node.parent = null;
+ root.left.parent = node;
+
+ }
+
+ else if (tempGrandParent.parent == null) {
+
+ root = tempParent;
+ tempGrandParent.right = null;
+ root.left = tempGrandParent;
+
+ node.parent.parent.parent = node.parent;
+ node.parent.parent = null;
+
+ if (tempLeft != null) {
+ tempLeft.parent = node.parent.left;
+ node.parent.left.right = tempLeft;
+ }
+
+ }
+
+ else if (isLeftChild(tempParent) && isRightChild(temp)) {
+
+ grandparent(node).left = temp;
+ tempParent.right = null;
+ node.left = tempParent;
+
+ node.parent = tempGrandParent;
+ node.left.parent = temp;
+
+ } else if (isRightChild(tempParent) && isRightChild(temp)) {
+
+ if (isLeftChild(grandparent(node))) {
+ grandparent(node).parent.left = node.parent;
+ } else {
+ grandparent(node).parent.right = node.parent;
+
+ }
+
+ tempGrandParent.right = null;
+
+ node.parent.left = tempGrandParent;
+
+ node.parent.parent = tempGrandParent.parent;
+ sibling(node).parent = node.parent;
+
+ if (tempLeft != null) {
+ tempLeft.parent = node.parent.left;
+ node.parent.left.right = tempLeft;
+ }
+ }
+ }
+
+ /**
+ * Right rotates the tree to ensure red and black tree properties are fulfilled.
+ * @param node is the node used as a pivot.
+ */
+ private void rightRotate(RBNode node) {
+
+ RBNode temp = node;
+ RBNode tempParent = node.parent;
+ RBNode tempGrandParent = grandparent(node);
+
+ RBNode tempRight = tempParent.right;
+
+ if (node.parent.parent == null) {
+
+ root = temp;
+ tempParent.left = null;
+ root.right = tempParent;
+
+ node.parent = null;
+ root.right.parent = node;
+
+ } else if (tempGrandParent.parent == null) {
+
+ root = tempParent;
+ tempGrandParent.left = null;
+ root.right = tempGrandParent;
+
+ node.parent.parent.parent = node.parent;
+
+ node.parent.parent = null;
+
+ if (tempRight != null) {
+ tempRight.parent = node.parent.right;
+ node.parent.right.left = tempRight;
+ }
+ }
+
+ else if (isRightChild(tempParent) && isLeftChild(temp)) {
+
+ grandparent(node).right = temp;
+ tempParent.left = null;
+ node.right = tempParent;
+ node.parent = tempGrandParent;
+
+ node.right.parent = temp;
+
+ }
+
+ else if (isLeftChild(tempParent) && isLeftChild(temp)) {
+
+ if (isLeftChild(grandparent(node))) {
+ grandparent(node).parent.left = node.parent;
+ } else {
+ grandparent(node).parent.right = node.parent;
+
+ }
+
+ tempGrandParent.left = null;
+ node.parent.right = tempGrandParent;
+
+ node.parent.parent = tempGrandParent.parent;
+ sibling(node).parent = node.parent;
+
+ if (tempRight != null) {
+ tempRight.parent = node.parent.right;
+ node.parent.right.left = tempRight;
+ }
+
+ }
+
+ }
+}
\ No newline at end of file