# From RedBlackBSTEssential Class mentioned above // When called…

Question Answered step-by-step # From RedBlackBSTEssential Class mentioned above // When called… Image transcription textAssignment 6 Tree drawings, part 2 28 points In a similar fashion to the trees from assignment 4, for thisassignment you are to create four tree drawings. You may use the visualization web page I’ve used or thedrawTree () method in the RedBlackBSTEssential class. All of the drawings must be in a single do… Show more… Show more# From RedBlackBSTEssential  Class  mentioned above   // When called with no arguments, the tree will be displayed   // with keys and values.public void drawTree() { drawTree(true);}// The displayValue parameter determines whether or not a node’s// value is displayed along with the key.public void drawTree(boolean displayValue) { if (root != null) {  StdDraw.setPenColor (StdDraw.BLACK);  StdDraw.setCanvasSize(1200,700);  // StdDraw.text(0.1, 0.95, “Left-leaning red-black BST)”);  /*  if (displayValue)   StdDraw.text(0.1, 0.92, “Node text: key, value”);  else   StdDraw.text(0.1, 0.92, “Node text: key”);  */  drawTree(root, .5, 0.95, .15, 0, displayValue); }}/* * This draws the tree from the node n down to the leaves below it. */private void drawTree (Node node, double x, double y, double range, int depth, boolean displayValue) { int CUTOFF = 10; String nodeText; if (displayValue)  nodeText = node.key.toString()+”,”+node.val.toString(); else  nodeText = node.key.toString(); StdDraw.text (x, y, nodeText); StdDraw.setPenRadius (.007); if (node.left != null && depth != CUTOFF) {  if (node.left.color == RED) {   StdDraw.setPenColor (StdDraw.RED);  }  StdDraw.line (x-range, y-.08, x-.01, y-.01);  StdDraw.setPenColor (StdDraw.BLACK);  drawTree (node.left, x-range, y-.1, range*.5, depth+1, displayValue); } if (node.right != null && depth != CUTOFF) {  StdDraw.line (x+range, y-.08, x+.01, y-.01);  drawTree (node.right, x+range, y-.1, range*.5, depth+1, displayValue); } Computer Science Engineering & Technology Object-Oriented Programming CSC 403 Share QuestionEmailCopy link Comments (0)