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

I neeeed hellp to complete this assignment I supposed to write a code that will

ID: 3693129 • Letter: I

Question

I neeeed hellp to complete this assignment I supposed to write a code that will return a inorder recursive and postorder recursive node by createing the binary search tree for the treetester class can some one please help me thank you

A postorder traversal of a binary tree uses the following recursive pattern to visit all the nodes in a tree n:

Postorder(n)   

1. Visit the left subtree of n

2. Visit the right subtree of n

3. Visit the root of n

Similarly, an inorder traversal of a binary tree uses the following recursive pattern to visit all the nodes in a tree n:

Inorder(n)       

1. Visit the left subtree of n

2. Visit the root of n

3. Visit the right subtree of n

In this lab, you will complete the code in the Node class for

1.      ThepostorderPrintNodemethod that implements a postorder traversal of nodes, and

2.      The postorderPrintNode method so that each node in the tree is visited in postorder.

After providing the code for these methods, use the TreeTester main method to create a binary search tree and visit the nodes in postorder and inorder, printing the objects referenced by each node. Each process starts when the respectivepostorderPrint/inorderPrint method in BinarySearchTree is first invoked. Notice that these methods invokes recursive calls to their respectivepostorderPrintNode/postorderPrintNodemethods in the Node class:

The code for the BinarySeachTree and TreeTester classes is as follows:

Explanation / Answer

public void postorderPrintNode(Node n) { if(n.left!=null) postorderPrintNode(n.left); if(n.right!=null) postorderPrintNode(n.right); System.out.println(n.data); } public void inorderPrintNode(Node n) { if(n.left!=null) inorderPrintNode(n.left); System.out.println(n.data); if(n.right!=null) inorderPrintNode(n.right); }