Java homework help

//// LLRB — L(eft)-L(eaning) R(ed)-B(lack) BST// // This class stores a set of integer keys using a left-leaning red-black BST//// HOMEWORK in this file is to implement://// 1) public void insert()// 2) public boolean containsRightRedEdge()// 3) public boolean containsConsecutiveLeftRedEdges()// 4) public int countBlackEdgesOnLeftmostPath()// 5) public boolean sameBlackEdgesCountOnAllPaths(int count)//// As BONUS, there is one additional method to implement//// 1) public void fixLLRB()// package hw4; public class LLRB {    private static final boolean RED   = true;    private static final boolean BLACK = false;        public Node root; public class Node {public int key;public boolean color;public Node left, right; public Node(int key, boolean color) {this.key = key;this.color = color;}} // Constructor for LLRBpublic LLRB() {} // Is parent link for node x red? false if x is nullprivate boolean isRed(Node x) {if (x == null) return false;return x.color == RED;} // Inserts a key without fixing the treepublic void bstInsert(int key) {root = bstInsert(root, key);} // Recursive helper method for bstInsertprivate Node bstInsert(Node x, int key) {if (x == null) return new Node(key, RED);if (key < x.key) x.left  = bstInsert(x.left, key);else if (key > x.key) x.right = bstInsert(x.right, key);return x;} // Inserts a key fixing the red-black tree propertypublic void insert(int key) {// TODO : complete this method} // Checks whether the tree contains a red right edgepublic boolean containsRightRedEdge() {// TODO : complete this methodreturn false;} // Checks whether the tree contains two left red edges in a rowpublic boolean containsConsecutiveLeftRedEdges() {// TODO : complete this methodreturn false;} // Returns the maximum number of black edges (nodes) on any path from root to nullpublic int maxBlackEdgesDepth() {// TODO : complete this methodreturn 0;} // Returns the minimum number of black edges (nodes) on any path from root to nullpublic int minBlackEdgesDepth() {// TODO : complete this methodreturn 0;} // Checks whether the BST is a valid left leaning red-black treepublic boolean isValidLLRB() {return (maxBlackEdgesDepth() == minBlackEdgesDepth() && !containsRightRedEdge() &&!containsConsecutiveLeftRedEdges());}    // Fixes the red-black tree if there is something to fixpublic void fixLLRB() {// TODO : complete this method}}

Are you looking for a similar paper or any other quality academic essay? Then look no further. Our research paper writing service is what you require. Our team of experienced writers is on standby to deliver to you an original paper as per your specified instructions with zero plagiarism guaranteed. This is the perfect way you can prepare your own unique academic paper and score the grades you deserve.

Use the order calculator below and get started! Contact our live support team for any assistance or inquiry.

[order_calculator]