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

Main points of this past exam are: Prim Algorithm, Minimum Spanning Tree, Algorithm, Demonstrate, Weighted, Difference Between, Trail, Simple Graph, Connected Graph, Complete Graph

Typology: Exams

2012/2013

Uploaded on 03/28/2013

beboo
beboo 🇮🇳

4.4

(14)

242 documents

1 / 6

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)
Autumn 2008
Computer Science
(Time: 3 Hours)
Answer FOUR questions
Examiners: Dr. Mel O Cinnéide
Mr. Martin Donnelly
Mr. Vincent Ryan
Question 1.
a) Using Prim'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 Prim's algorithm was used will attract zero marks.
[8 Marks]
b) In graph theory, what is the difference between a trail and a path? [3 Marks]
c) Explain the terms multigraph, simple graph, connected graph and complete graph.
[4 Marks]
d) 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]
e) 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 Prim'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)

Autumn 2008

Computer Science

(Time: 3 Hours)

Answer FOUR questions Examiners: Dr. Mel O Cinnéide Mr. Martin Donnelly Mr. Vincent Ryan

Question 1. a) Using Prim'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 Prim's algorithm was used will attract zero marks. [8 Marks]

b) In graph theory, what is the difference between a trail and a path? [3 Marks]

c) Explain the terms multigraph , simple graph , connected graph and complete graph. [4 Marks]

d) 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]

e) 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) Prove the following result: Let G=(V,E) be a connected planar graph or multigraph and let |V|=n and |E|=e. Let r be the number of regions in the plane determined by a plane drawing of G, including the infinite region. Then, n - e + r = 2 [7 Marks]

b) What do you understand by the term elementary subdivision? [3 Marks]

c) Consider the following result: Every loop-free, connected graph, which is planar, has a vertex of degree at most X. What is the value of X? [3 Marks]

d) Draw the Petersen Graph. [2 Marks]

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

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

a) On the first Sunday of 2002, John starts a chain letter by sending six letters to six friends. Each person receiving the letter is to send 6 copies to 6 new people, on the Sunday following the letter’s arrival. How many weeks pass before 5000 people have received a letter? If each letter has a unique number, and all 5000 letters are put together by John and the required number of letters, including those to be sent on, are sent to each person, how many people send no letters? [7 Marks]

b) Using the Ford-Fulkerson algorithm, find the maximum flow through the transport network below. From the outcome of the application of the algorithm, identify the minimum cut.

[8 Marks]

c) Consider the following recursive function:

int BBB( int n ) { if ( n==1 ) return 4; else return( BBB(n-1) + 4BBB(n-1) ); }*

Give a full complexity analysis of the code, leading to finding the big-Oh of the code. [10 Marks]

A Z

G

F

D

B E

a) Distinguish between two graphs being equal and two graphs being isomorphic. Use an example to enhance your answer. [3 Marks]

b) Give an example of a graph which has an Euler Circuit, but does not have a Hamilton Cycle. [3 Marks]

c) List the 4 guidelines that we use when testing whether a graph is Hamiltonian. [3 Marks]

d) A nursery school has children of different ages attending. Every day, the teacher wished to form a line for lunch, in such a way that no child is next to a child who is the same age as him/herself. If the school has 23 children, and most of the children are of age 4, what is the maximum number of 4 year olds that the school can have so that the teacher is guaranteed that such a line can always be formed?

In answering this question, you must use a graph to model the situation, explain clearly and in detail what each aspect of the graph represents, and quote in detail the result(s) that you use in arriving at your solution. [6 Marks]

e) Describe how one can take an optimisation problem and restate it in such a way that if the optimisation problem has a polynomial-time solution, then the decision problem has one also. [3 Marks]

Use the Travelling Salesman problem as an example to illustrate your answer. [4 Marks]

f) Explain the compositeness problem, and give an example of a witness for the problem if the number being tested is 500. [3 Marks]