Programming assignment learning objectives: Binary tree structure and traversal implementation.
This assignment is on binary trees. The attached file provides a Treetest class, as the main program to test your binary tree code, and a TreeNode class. The TreeNode class is missing the method code to insert a node into the binary tree, and it is missing code for the three types of binary tree traversal (inorder, postorder, preorder). Your assignment is to complete the binary tree code so that it will effectively insert nodes and display all three types of binary tree traversals correctly. When building a binary tree, all nodes are inserted as leaf nodes and the smaller value is always to the left of the parent node. This program completes three types of traversals on a binary tree using a sentence input by the user. The words in the sentence are parsed into a binary tree structure in alphabetical order. Test your code using the following input: “This is my favorite programming assignment”. Make sure to provide some commends on each code line. Your execution screenshot for a correct program should look like the following:
Please enter a string
this is my favorite programming assignment
Preorder traversal
this is favorite assignment my programming
Inorder traversal
assignment favorite is my programming this
Postorder traversal
assignment favorite programming my is this
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here