please finish the java program

RedBlackTree Specifications

  1. Start by making a copy of your RedBlackTree class from last week’s Rotation Activity. You can also remove the three JUnit Test methods from this copy, since they may break while changing the mechanics of this new class’s insert operation. If there are any unresolved bugs in your code from last week’s activity, please work through fixing those first. If additional assistance from the course staff would be helpful for this, please contact us for that help.
  2. Add a public boolean isBlack field to the Node<T> class.  Ensure that every newly instantiated Node object has a false isBlack field (so that all new nodes are red by default).
  3. At the end of the insert method, add a statement to always set the root node of your red black tree to be black. No further changes to this method should be made.
  4. Add a new private method to your RedBlackTree class called enforceRBTreePropertiesAfterInsert which takes a reference to a newly added red node as its only parameter. Note that this method may also be called recursively, in which case the input parameter may reference a different red node in the tree that potentially has a red parent node. The job of this enforceRBTreePropertiesAfterInsert method is to resolve any red property violations that are introduced by inserting new nodes into a red-black tree. While doing so, all other red-black tree properties must also be preserved.
  5. The enforceRBTreePropertiesAfterInsert method should be called from insertHelper after adding a new red node to the tree (in both the cases of adding this new node as a left child and as a right child). No further changes to the insertHelper method should be made.
  6. Implement the enforceRBTreePropertiesAfterInsert method to recognize and handle each of the possible cases described in your lecture videos and readings. You should make use of the rotate method that you implemented last week, by calling it from your definition of enforceRBTreePropertiesAfterInsert. Implementing this method correctly should ensure that the worst-case height of your tree remains O(log n), where n = the size or number of elements stored in your red black tree.
  7. To help keep your RedBlackTree implementation compatible with your team’s Project Two Application, avoid adding any extra fields or methods to these classes, other than those explicitly described above. Also notice that you are not being asked to implement the remove operation for this red black tree implementation.
  1. TestRedBlackTree Requirements

    In addition to your RedBlackTree.java implementation, you must develop and submit a JUnit test class within a separate source file named TestRedBlackTree.java. This test class must include at least four distinct and descriptively named test methods. Each test should be designed to test a different case for inserting into a red black tree, and ensuring that your enforceRBTreePropertiesAfterInsert method functions is being used correctly. Be sure to include JavaDoc style method header comments for each of these test methods that clearly describe what high-level “case” they are testing.

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more