For this code updated BST class and complete the preOrder me
For this code updated BST class and complete the preOrder() method so that it performs a preOrder traversal of the tree. For each node it traverses, it should call sb.append() to add a \"[\" the results of traversing the subtree rooted at that node, and then a \"]\". You should add a space before the results of the left and right child traversals, but only if the node exists.
Code:
Solution
Hi, Please find my implementation.
 /* Method to complete is here! */
 public void preOrder(Entry ent, StringBuilder sb) {
   
    if(ent == null) // root is null
        return;
   // appending root value in sb
    sb.append(ent.element+\" \");
   //calling preOrder for left subtree
    preOrder(ent.left, sb);
   //calling preOrder for right subtree
    preOrder(ent.right, sb);
 }

