public class BinarySearchTree
{
public class TreeNode
{
private int item;
private TreeNode leftLink;
private TreeNode rightLink;
// One constructor for TreeNode
///////////////////////////////////////////////////////
public TreeNode(int newItem, TreeNode left, TreeNode right)
{
item = newItem;
leftLink = left;
rightLink = right;
}
} // End of TreeNode inner class
// Declaration of class BinarySearchTree begins here.
// Three instance variables.
private TreeNode root;
private TreeNode parent; // parent node of a target node being sought
private int parentLink; // pointer number of a parent node being sought
public BinarySearchTree( )
{
root = parent = null;
parentLink = 0; // no such pointer at the beginning
}
i want a deep copy for this tree, heading should be same as given below, and it should work as describe, This constructor will create a binary search tree which is a deep copy of an existing one that is given by the lone parameter of this constructor.
public BinarySearchTree (BinarySearchTree bst)
{
//your code should be here
}
// more codes here but given code is ok for question
}