Question 3) Set out your answers in the Table 2 below (see workshop video, Handout Example 5, or Week 8 practical questions 1 and 2). You may not need all given rows. Edges Ø Step N(1) N(2) N(3) N(4) N(5) N(6) Init. 1 2 3 4 5 6 1 2 3 V2V6 V3 V4 6 4 4 5 6 7 8 9 Table 2 (for Question 3) (b) Draw your spanning tree on the following set of vertices. V1 V6 V₂ V3 V4 V5V1 5 V6V1 11 Weight 0
Question 5 (2 marks) Consider the following binary expression tree. a b с ·|·• + b * (a) Write down the expression obtained from preorder traversal. (b) Write down the expression obtained from postorder traversal. C For each case, use comma "," to separate data from each node. (Explanation is not required.)
(a) Apply Kruskal's algorithm to find a minimum spanning tree and its weight for the graph on 6 vertices V1, V2, V3, V4, V5, V6 with the following edges and weights respectively as in Table 1 below. edges V2V5 weights 12 V3V5 V3V1 V4 V5 V4V1 2 9 1 7 Table 1 (for (a) Apply Kruskal's algorithm to find a minimum spanning tree and its weight for the graph on 6 vertices V1, V2, V3, V4,
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am