Question: In the zip file there are four incomplete files, PrettyPrinterl.java, PrettyPrinter2.java, PrettyPrinter3.java and Hw1.jav a. Your task is to complete the four incomplete files. In

 In the zip file there are four incomplete files, PrettyPrinterl.java, PrettyPrinter2.java,PrettyPrinter3.java and Hw1.jav a. Your task is to complete the four incomplete

In the zip file there are four incomplete files, PrettyPrinterl.java, PrettyPrinter2.java, PrettyPrinter3.java and Hw1.jav a. Your task is to complete the four incomplete files. In addition, the zip file includes three files, BTree.java, Traverse.java, and BrettyPrinteroiaxathat are written for you and should not be modified. The term "prettyprint" usually means finding a way to represent a tree as a multi-line string. For example, this binary tree, This representation can be made even more compact. In this string, the root of every left child is "inlined" with its parent's root. (a (b d e) (S () (E (g () h) () ) In the file PrettyPrinterl.java, complete the method prettyPrinter) so that it implements the first kind of prettyrinting described above. In the file PrettyPrinter2.java, complete the method BrettxeaintREW so that it implements the second kind of prettyprinting described above. And in the file PrettyPrinter3.java, complete the method grettvErinteEW so that it implements the third kind of prettyrrinting described above. In the zip file there are image files for five binary trees, the tree above and the four trees below. h. while sqit complete the Java declarations that instantiate binary trees that represent each of the binary trees in these image files (the first one is done for you). Then compile and run your program. The three prettyXRinting methods are, for the most part, a variation on a preorder traversal of the binary tree. First you prettyprint the root, then you (recursively) prettyrrint the left sub tree, then (recursively) prettyrrint the right sub tree. For the first prettyprinter, you need to think about three cases, the empty tree, a tree of just a single node, and a tree with more than one node. For the second prettyrrinter, you need to consider four cases, an empty tree, a tree of a single node, a tree of depth one, and a tree of depth greater than one. For the third prettyrrinter, you have the same four cases, but the root of the left child is always in-line with its parent's root (and be sure to keep opening and closing parentheses vertically aligned). In the zip file there are four incomplete files, PrettyPrinterl.java, PrettyPrinter2.java, PrettyPrinter3.java and Hw1.jav a. Your task is to complete the four incomplete files. In addition, the zip file includes three files, BTree.java, Traverse.java, and BrettyPrinteroiaxathat are written for you and should not be modified. The term "prettyprint" usually means finding a way to represent a tree as a multi-line string. For example, this binary tree, This representation can be made even more compact. In this string, the root of every left child is "inlined" with its parent's root. (a (b d e) (S () (E (g () h) () ) In the file PrettyPrinterl.java, complete the method prettyPrinter) so that it implements the first kind of prettyrinting described above. In the file PrettyPrinter2.java, complete the method BrettxeaintREW so that it implements the second kind of prettyprinting described above. And in the file PrettyPrinter3.java, complete the method grettvErinteEW so that it implements the third kind of prettyrrinting described above. In the zip file there are image files for five binary trees, the tree above and the four trees below. h. while sqit complete the Java declarations that instantiate binary trees that represent each of the binary trees in these image files (the first one is done for you). Then compile and run your program. The three prettyXRinting methods are, for the most part, a variation on a preorder traversal of the binary tree. First you prettyprint the root, then you (recursively) prettyrrint the left sub tree, then (recursively) prettyrrint the right sub tree. For the first prettyprinter, you need to think about three cases, the empty tree, a tree of just a single node, and a tree with more than one node. For the second prettyrrinter, you need to consider four cases, an empty tree, a tree of a single node, a tree of depth one, and a tree of depth greater than one. For the third prettyrrinter, you have the same four cases, but the root of the left child is always in-line with its parent's root (and be sure to keep opening and closing parentheses vertically aligned)

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!