Using the tree program, write a program to input twenty integers into a tree.The program should print out the inorder, preorder and postorder traversals for the tree indicating the LEVEL of each node as it is printed out.In addition to that there should be statements indicating :
The number of leaves in the treeThe number of nodes with only one childThe number of nodes with two childrenThe maximum and minimum leaf levelsThe height of the treeAlso indicate if the tree is balanced
For Exampleif you entered the values45366789923114455628890321410392
The tree program I gave you would print out that the root is 45, that 3 is the left of 45,66 is the right of 45, etc etc
It would then do the inorder traversal:0 (level 3)2 (level2)3 (level1)6 (level 3)etc
Then you would say (not necessarily correct) something like:There are 8 leaf nodesThere are 4 nodes with one childThere are 7 nodes with two childrenMaximum leaf level = 6Maximum leaf level = 3not balancedheight = 6
Reviews
There are no reviews yet.