(C,8,2) (D,6,1) (E,9,4) (F,2,-1) (J,3,9)
void f3() - Suppose p is the 7th node when performing the breadth-first traversal of the tree and fa is p's father. Delete p by copying. Output in the file f3.txt must contain 3 lines: statements to display line 1 and line 3 are already given. You must use the statement f.writeBytes(fa.info + "\r\n"); to display fa in line 2.
(C,8,2) (D,6,1) (E,9,4) (F,2,-1) (G,7,3) (H,10,8) (1,1,7) (J,3,9) (K,-1,5) (L,5,10) (M,4,6)
(F,2,-1)
(C,8,2) (D,6,1) (E,9,4) (F,2,-1) (G,7,3) (H,10,8) (K,-1,5) (J,3,9) (L,5,10) (Μ,4,6)
2
void f4() - Suppose p is the 2nd node having left-child when performing the pre-order traversal of the tree from the root. Rotate p to right. Output in the file f4.txt must be the following:(C,8,2) (D,6,1) (E,9,4) (F,2,-1) (G,7,3) (H,10,8) (1,1,7) (J,3,9) (K,-1,5) (L,5,10) (Μ,4,6)
(C,8,2) (F,2,-1) (E,9,4) (1,1,7) (D,6,1) (Η,10,8) (Κ,-1,5) (J,3,9) (G,7,3) (L,5,10) (M,4,6)
Question 3: (2 marks)
In this question vou should complete some methods in Graph.iava file.
+ 127%
Zoom
Close