Question: need help for toString method public class BinaryTree { //Implements a Binary Tree of Strings private class Node { private Node left; private String data;

need help for toString method

public class BinaryTree {

//Implements a Binary Tree of Strings

private class Node {

private Node left;

private String data;

private Node right;

private Node parent; // reference to the parent node

// the parent is null for the root node

private Node(Node L, String d, Node r, Node p) {

left = L;

data = d;

right = r;

parent = p;

}

}

private Node root;

public BinaryTree() {

// create an empty tree

root = null;

}

public String toString() {

// returns the string representation of the tree using the in order format

// If the tree was created from a string use the

// the values of open, close and empty given to the constructor otherwise

// use (, ) and ! for open, close and empty respectively

// most of the work should be done in a recursive private method.

}

need help for toString method public class BinaryTree { //Implements a Binary

Tree tvn Sthig Rappesetoarem Tree tvn Sthig Rappesetoarem

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!