Assignment 2 (Online Version)
Assignment 2 (Online Version)
Assignment 2 (Online Version)
Question 1
Graphs
(a) Based on the graphs below, complete the table below. Do they contain an Euler Path,
Euler Circuit or neither? (9 marks)
Graph 1 Graph 2 Graph 3
Question 2
Graphs
Give the name of the item to the description relating to a given graph G. (9 marks)
(a) Any edge which starts and ends at the same vertex.
(b) Any edge which disconnects the graph when deleted.
(c) Any line joining two vertices of the graph.
(d) The number of edges which meet at a given vertex.
(e) Two edges of a graph are connected by a common vertex.
(f) Two vertices joined by a single edge.
(g) Any sequence of adjacent edges which appear only once.
(h) A sequene of adjacent vertices which start and end at the same place.
(i) A graph where two vertices are joined by a graph.
Question 3
Trees
Use Prim’s algorithm to find a minimum spanning tree in the following weighted graph.
(12
marks)
B 5 D
2 2
A 6 3 1 Z
3 2 4
C E
Question 4
Trees
For the following questions, consider the rooted tree (T, v0) shown below. (10 marks)
V0
V3
V1
V5 V2 V9
V4
V16
Question 5
Trees
(a) Define
i. Spanning tree (2 marks)
ii. A minimal spanning tree (1 mark)
iii. A binary tree. (2 marks)
(b) Explain Tree Traversal in Computer Science context. (2 marks)
(c) Based on the following binary search tree, find the tree traversals sequence of
i. Pre-order (1 mark)
ii. In-order (1 mark)
iii. Post-order (1 mark)