Question
my code: public String serialize() { return serialize(root); } private String serialize(BTNode node) { if (node == null) { return X(NULL); } if (node.getLeft() ==
my code:
public String serialize() { return serialize(root); }
private String serialize(BTNode
package cs1501_p1;
public class BST
public void put(T key) // Add a new key to the BST { BTNode
Successfully built an empty tree! FAILED Expected: R(10),I(5),L(2),X(NULL),I(37),X(NULL),L(45) Actual: X(45),X(37),X(10),X(2),L(5) please fix and help!!!
serialize() : Perform a pre-order traversal of the BST in order to produce a String representation of the BST. The reprsentation should be a comma separated list where each entry represents a single node. Each entry should take the form: type(key). You should track 4 node types: R : The root of the tree - I: An interior node of the tree (e.g., not the root, not a leaf) - L: A leaf of the tree - x : A stand-in for a null reference For each node, you should list its left child first, then its right child. You do not need to list children of leaves. The x type is only for nodes that have one valid child. The key for an x node should be NULL (all caps). Consider the followingStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started