Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

hello i have to create binary.t with in, post,pre order with java program. Here

ID: 3551768 • Letter: H

Question

hello i have to create binary.t with in, post,pre order with java program.


Here is my code... it is working good..


but i have one little error..

number '1' is not supposed to show up. other numbers traversed well.

so i changed BinTree tree= new BinTree(1);->BinTree tree= new BinTree(0); but it showed up 0.

and i try to put in null in there. but occur error.

please help me ~~~~~ i dont want to chage my code. thanks


output


building binary tree...

13 80 93 90 46 56 97 88 81 14


Inorder traversal

1

13

14

46

56

80

81

88

90

93

97



Preorder traversal

1

13

14

46

56

80

81

88

90

93

97



Post traversal

13

14

46

56

80

81

88

90

93

97

1

Explanation / Answer

The problem is that you are initializing "tree" with 1.
change the main function to:

}
It will work fine and will have 11 random numbers now. If you want to keep it to 10 just run the loop for 9 times