Question: Need help with this in Java. The problem involves writing a constructor to read in the preorder representation of a binary tree Given the binary

Need help with this in Java.
The problem involves writing a constructor to read in the preorder representation of a binary tree Given the binary tree shown below:
Its preorder representation is (53(28(11**)(41**))(83(67**)*)) The
asterisks represent null children.
Need to implement parsing logic here that constructs the binary tree
from the preorder representation, and handles syntax validation.
Everything digit after the '(' is either a new node (parent node) or left node . If number of "(' matches number of ')' that equals to one full node.
One we get the the last ')' and it all right and left delimeters match it is a tree.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!