2
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) (1,2,5) (Υ,1,6)
void f4() - Print out leaf nodes of the tree. Output in the file f4.txt must be the follwing: (line 1:pre-order traversal, line 2: leaf nodes (by pre-order traversal))(A,6,5) (B,2,7) (P,1,9) (C,3,-8) (D,5,-3) (E,8,3) (G,7,4) (Q,9,1)
(P,1,9) (D,5,-3) (G,7,4) (Q,9,1)
void f5()- How many internal nodes are there in the BST? Output in the file f5.txt must be the following: (line 1: in-order traversal, line 2: the amount of internal nodes)(L,1,5) (H,2,6) (Q,3,1) (D,4,3) (B,6,-4) (M,7,9) (X,8,7) (G,9,-6)
4
Zoom
+ 90%
Close