Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

WE have to add the printPostorder() method into the BinarySearchTree1 class. As

ID: 3757417 • Letter: W

Question

WE have to add the printPostorder() method into the BinarySearchTree1 class. As shown below.

public class BinarySearchTreeNode
{
public int key;
public BinarySearchTreeNode left;
public BinarySearchTreeNode right;
  
  
}
  
public class BinarySearchTree1
{
private BinartSearchTreeNode root;
public void insert(int key){}
public void delete(int key){}
public void find(int key){}

d) Add method public void printPostorder() to the BinarySearchTree class that prints out the nodes of the tree according to a "postorder" traversal. So the tree.. 4 2 1 Produces the output "1 3 2 5 4" Note: You will need an assistant/helper method

Explanation / Answer

void printPostorder(BinarySearchTreeNode root)

{

if(root==null)

return;

printPostOrder(root.left);

printPostorder(root.right);

System.out.print(root.key + " ");

}

public void printPostorder()

{

printPostorder(root);

}