OUTPUT
(49, A, 50) (25, B, 25) (11, D, 50) (0, 1, 20) (-1, Q, 17) (17, J, 12) (36, E, 42) (30, K, 22) (42, L, 47) (74, C, 25)(61, F, 34) (55, M, 18) (66, N, 15) (86, Η, 35) (81, 0, 0) (93, PG, 32)
(49, Α, 50) (30, Κ, 22) (11, D, 50) (0, 1, 20) (-1, Q, 17) (17, J, 12) (36, E, 42) (42, L, 47) (74, C, 25) (61, F, 34)(55, M, 18) (66, N, 15) (86, H, 35) (81, 0, 0) (93, PG, 32)
def f4(self, x) - Perform pre-order traversal from the root and find the first node p having right child and price smaller than given x value. Rotate p to left about its' right child. Output in this case like that:
OUTPUT
(49, A, 50) (25, B, 25) (74, C, 25) (11, D, 50) (36, E, 42) (61, F, 34) (86, H, 35) (0, 1, 20) (17, J,12) (30, Κ, 22) (42, L, 47) (55, M, 18) (66, N, 15) (81, 0, 0) (93, PG, 32) (-1, Q, 17)(49, A, 50) (36, E, 42) (74, C, 25) (25, B, 25) (42, L, 47) (61, F, 34) (86, H, 35) (11, D, 50) (30, Κ,22) (55, M, 18) (66, N, 15) (81, 0, 0) (93, PG, 32) (0, 1, 20) (17, J, 12) (-1, Q, 17)
Question 3: (2 marks)
In this question you should complete some methods in Graph.py file.
The class Graph is the implementation of a graph. The following methods should be completed:
def f1(self, start) - Perform breadth-first traversal from the vertex start (the vertex C) and the results are displayed in three lines. The first line shows only the degree of each vertex
>
Zoom
+ 100%
Close