Assignment 2 (Online Version)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

POLITEKNIK KUCHING SARAWAK

JABATAN MATEMATIK, SAINS & KOMPUTER


KM22, JLN MATANG, 93050 KUCHING

B2009 DISCRETE MATHEMATICS


ASSIGNMENT 2

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

Graph Number of Odd Number of Even Euler Path / Euler Circuit /


Degree Degree Neither
1
2
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

V11 V12 V6 V7 V8 V10


V14
V15 V13

V16

(a) List all level 1-vertices.


(b) List all leaves.
(c) What are the siblings of v2?
(d) What are the descendants of v8?
(e) Compute the tree T(V3).
(f) What is the height of (T, v0)?

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)

You might also like