xPlace.charAt(0) == 'F' is not inserted to the tree. The output in file f1.txt should be as follows (line1: Breadth first traversal, line 2: In-order traversal)
(Χ,5,2) (Ν,3,6) (Μ,9,5) (P,1,3) (R,4,8) (Q,8,7)
(P,1,3) (N,3,6) (R,4,8) (X,5,2) (Q,8,7) (M,9,5)
void f2() - Perform pre-order traversal for the right branch of the BST, but display to file f2.txt nodes with color<8 only.
Hint: Copy the function preOrder(...) to function preOrder2(...) and modify it.
Output in the file f2.txt must be the following (line 1: Breadth first traversal, line 2: pre-order traversal)
(P,7,9) (D,4,3) (G,9,6) (H,2,5) (B,6,4) (Χ,8,9) (L,1,8) (N,3,1)
(G,9,6)
void f3() - Perform a new traversal method to visit all nodes in the BST with the constraint: visit the nodes in the descending order of weight. Output in the file f3.txt must be the following:(T,8,-5) (M,7,2) (P,6,3) (R,5,9) (S,4,1) (L,2,5) (Y,1,6)
2
Zoom
+ 90%
Close