Kruskal's Algorithm - Computer Science - Exam, Exams of Computer Science

Main points of this past exam are: Kruskals Algorithm, Minimum Spanning Tree, Algorithm, Algorithm, Demonstrate, Steiner-Tree Problem, Specification Changes, Slight Modification, Polynomial-Time Problem, Packing Problem

Typology: Exams

2012/2013

Uploaded on 03/28/2013

beboo
beboo 🇮🇳

4.4

(14)

242 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Cork Institute of Technology
Bachelor of Science (Honours) in Software Development – Stage 3
(KSDEV_8_Y3)
Spring 2008
COMPUTER SCIENCE
(Time: 3 Hours)
Answer any four questions. Examiners: Mr. V. Ryan
Dr. M. O Cinneide
Mr. M. Donnelly
Question 1
a) Using Kruskal's Algorithm, find the minimum spanning tree of the following weighted
graph. You must demonstrate clearly that you used the algorithm. A solution that does not
demonstrate that Kruskal's algorithm was used will attract zero marks.
[8 Marks]
b) Prove that in any graph or multigraph, the number of vertices of odd degree is even.
[7 Marks]
c) Describe the Steiner-tree problem.
Explain how a slight modification to the problem specification changes it from an NP-
Complete problem to a polynomial-time problem. [5 Marks]
d) Explain the integer bin packing problem.
Give an algorithm for a brute force solution for this problem. [5 Marks]
38
60
16
14
56 82
21
69
8
12
74
47
A
B
C
D
E
F
G
pf3
pf4
pf5

Partial preview of the text

Download Kruskal's Algorithm - Computer Science - Exam and more Exams Computer Science in PDF only on Docsity!

Cork Institute of Technology

Bachelor of Science (Honours) in Software Development – Stage 3

(KSDEV_8_Y3)

Spring 2008

COMPUTER SCIENCE

(Time: 3 Hours)

Answer any four questions. Examiners: Mr. V. Ryan Dr. M. O’ Cinneide Mr. M. Donnelly

Question 1 a) Using Kruskal's Algorithm, find the minimum spanning tree of the following weighted graph. You must demonstrate clearly that you used the algorithm. A solution that does not demonstrate that Kruskal's algorithm was used will attract zero marks. [8 Marks]

b) Prove that in any graph or multigraph, the number of vertices of odd degree is even. [7 Marks]

c) Describe the S teiner-tree problem. Explain how a slight modification to the problem specification changes it from an NP- Complete problem to a polynomial-time problem. [5 Marks]

d) Explain the integer bin packing problem. Give an algorithm for a brute force solution for this problem. [5 Marks]

A

B

C

D

E

F

G

a) State the result of Kuratowski's Theorem. [3 Marks]

b) Using an example, explain what is meant by two graphs being homeomorphic. [3 Marks]

c) Consider the following graph Test and decide if it is planar or not. Use the testing process (with 4 steps) that we described in class.

If it is planar, verify Euler’s Formula for the graph. If it is non-planar, verify Kuratowski’s theorem for this graph. [9 Marks]

d) Give two definitions for the NP class of problems. [5 Marks]

e) Describe the subset-sum problem, and prove that it is in the class NP. [5 Marks]

A

B

C

D

E

F

c) What do you understand by the term polynomial-time reducibility? [3 Marks]

d) Explain the relevance of polynomial-time reducibility to the NP-Complete class of problems. [3 Marks]

e) Explain how the Hamilton Cycle Problem can be reduced to the Travelling Salesman Problem in polynomial time. [4 Marks]

a) Define the following terms as they apply to trees: rooted tree level height leaf [4 Marks]

b) An organisation wishes to give all of its employees a basic introduction to using product X. It approaches this by sending 3 of its employees on an expensive course. These 3 employees must then train exactly 5 others on using the product, and each of them must train exactly 5 more etc. In total, 28110 other employees must be trained in using the product. If it takes exactly 2 days to train a group of 5 employees, how many days after the return of the 3 employees who were sent on the course before all employees are trained in using product X. In answering, this question, you must model the situation using trees, and use result(s) developed in the course. State clearly the results that you use. [8 Marks]

c) What do you understand by the term prefix code. Use an example to enhance your answer. [3 Marks]

d) Consider the following recursive code:

void BubbleLargest(BigIntArray A, int n); { int i,temp; if (n > 1) { for (i= 1; i<n ; i++) if (A[i] > A[i+1]) { temp = A[i]; A[i] = A[i+1]; A[i+1] = temp; } BubbleLargest(A,n-1); } } Give a full complexity analysis of the code, leading to finding the big-Oh of the code. [10 Marks]

a) Prove that the number of walks of length q from vertex i to vertex j in a graph G=(V,E) with adjacency matrix M is Mq^ (i,j) [6 Marks]

b) Using Dijkstra’s shortest path algorithm, find the shortest path and its length between nodes A and H in the following graph. In your answer, detail the number of iterations of the algorithm that were needed in arriving at the solution, and exactly what happens during each iteration. Give the order in which each node was made permanent, and the labels on each node. [6 Marks]

c) Explain why Dijkstra’s Algorithm qualifies as being a greedy algorithm. [3 Marks]

d) Consider the Enumeration Sort algorithm. Give a full description, using an example, on how it works. [2 Marks]

Explain how the algorithm can be implemented to take advantage of parallelism. [5 Marks]

What would be the complexity of the algorithm as implemented in parallel? Explain why, without giving a full complexity analysis. [3 Marks]

A

B

C

D

E

F

G

H