void t2() - Perform pre-order traversal for the 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.
The expected output in the file f2.txt should be the following (line 1: Breadth first traversal, line 2:pre-order traversal)
(P,7,9) (D,4,3) (G,9,6) (L,1,8) (B,6,4) (Χ,8,9)
2
(D,4,3) (B,6,4) (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. The expected output in the file f3.txt should be the following:
(T,8,-5) (M,7,2) (P,6,3) (R,5,9) (S,4,1) (L,2,5)
Zoom
100%
Close