2
OUTPUT
(AY, 35, 35) (F, 25, 25) (H, 20, 20) (HQ, 18, 18) (Q1, 10, 10) (P, 21, 21) (Η, 31, 31) (Ε, 28, 28) (C, 32, 32) (B,45, 45) (D, 40, 40) (T, 39, 39) (C, 50, 50) (E, 52, 52) (Τ, 60, 60)
(AY, 35, 35) (H, 20, 20) (HQ, 18, 18) (Q1, 10, 10) (P, 21, 21) (Η, 31, 31) (Ε, 28, 28) (C, 32, 32) (B, 45, 45) (D,40, 40) (Τ, 39, 39) (C, 50, 50) (E, 52, 52) (Τ, 60, 60)
void f4(self) - Perform breadth-first traversal from the root and find the first node p having left child and age is an odd number. Rotate p to right about its' left child. Output in this case like that:
OUTPUT
(AY, 36, 35) (F, 26, 25) (B, 45, 45) (H, 20, 20) (H, 30, 31) (D, 40, 40) (C, 50, 50) (HQ, 18, 18) (P,21, 21) (E, 28, 28) (C, 32, 32) (T, 39, 39) (QY, 42, 42) (E, 52, 52) (Q1, 10, 10) (Τ, 60, 60)(AY, 36, 35) (F, 26, 25) (D, 40, 40) (H, 20, 20) (H, 30, 31) (Τ, 39, 39) (B, 45, 45) (HQ, 18, 18) (P,21, 21) (Ε, 28, 28) (C, 32, 32) (QY, 42, 42) (C, 50, 50) (Q1, 10, 10) (E, 52, 52) (Τ, 60, 60)
FINISH Question 3: (2 marks)
In this question you should complete some methods in Graph.py file.
The class Graph is the implementation of a granh. The following methods should be completed:
+ 100%
Zoom
Close