Question: * Learning Materials - Spring-2020 X C S 51530 - Homework math.pnw.edu/-Hkraft/cs51530/homework/hw1.html > CS 51530 - Homework 1 OOOO OOOO @ In the file Hw1.java,
* Learning Materials - Spring-2020 X C S 51530 - Homework math.pnw.edu/-Hkraft/cs51530/homework/hw1.html > CS 51530 - Homework 1 OOOO OOOO @ In the file Hw1.java, 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 output of your program should look exactly like the contents of the file output.txt contained in the zip file. The three prettyprinting methods are, for the most part, a variation on a preorder traversal of the binary tree. First you prettyprint the root, then you (recursively) prettyprint the left sub tree, then (recursively) prettyprint 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 prettyprinter, 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 prettyprinter, 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). Turn in a zip file called CS51530Hw1Surname.zip (where Surname is your last name) containing your versions of PrettyPrinter1.java, PrettyPrinter2.java, PrettyPrinter3.java and Hw1.java Be sure to put your name and email address in every file your turn in. This assignment is due Monday, January 27, * Learning Materials - Spring-2020 X C S 51530 - Homework math.pnw.edu/-Hkraft/cs51530/homework/hw1.html > CS 51530 - Homework 1 OOOO OOOO @ In the file Hw1.java, 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 output of your program should look exactly like the contents of the file output.txt contained in the zip file. The three prettyprinting methods are, for the most part, a variation on a preorder traversal of the binary tree. First you prettyprint the root, then you (recursively) prettyprint the left sub tree, then (recursively) prettyprint 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 prettyprinter, 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 prettyprinter, 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). Turn in a zip file called CS51530Hw1Surname.zip (where Surname is your last name) containing your versions of PrettyPrinter1.java, PrettyPrinter2.java, PrettyPrinter3.java and Hw1.java Be sure to put your name and email address in every file your turn in. This assignment is due Monday, January 27
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
