Weighted Graph, Euclid's Algorithm-Algorithm Design and Data Representation-Exam Paper, Exams of Data Representation and Algorithm Design

Prof. Anilaabh Suji took this paper at Aliah University for Data Representation And Algorithm Design course. It includes: Complexity, Algorithms, Weighted, Graph, Spanning, Tree, Euclid, Algorithm, Dijkstra, Fractional, Knapsack

Typology: Exams

2011/2012

Uploaded on 07/15/2012

sabeena
sabeena 🇮🇳

4.8

(8)

67 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COMP202 Class Exam 2
Complexity of Algorithms 28 March 2007
[NB: This examination contributes 10% to your overall final course grade.]
Answer all questions!
1. Consider the weighted graph below.
Find a minimum spanning tree of this graph using either algorithm we
discussed in class (those of Kruskal and Prim). Draw the subgraph that
consists of the edges in your minimum spanning tree and be sure to give
its total weight. [20 marks]
2. (a) What is the main observation that is (repeatedly) used in Euclid’s
algorithm? (Hint: gcd(a, b) =????) [10 marks]
(b) Demonstrate (i.e. show the steps of) Euclid’s algorithm on the inputs
224 and 63 to find gcd(224,63). [10 marks]
1
docsity.com
pf2

Partial preview of the text

Download Weighted Graph, Euclid's Algorithm-Algorithm Design and Data Representation-Exam Paper and more Exams Data Representation and Algorithm Design in PDF only on Docsity!

COMP202 Class Exam 2 Complexity of Algorithms 28 March 2007

[NB: This examination contributes 10% to your overall final course grade.]

Answer all questions!

  1. Consider the weighted graph below.

Find a minimum spanning tree of this graph using either algorithm we discussed in class (those of Kruskal and Prim). Draw the subgraph that consists of the edges in your minimum spanning tree and be sure to give its total weight. [20 marks]

  1. (a) What is the main observation that is (repeatedly) used in Euclid’s algorithm? (Hint: gcd(a, b) =????) [10 marks] (b) Demonstrate (i.e. show the steps of) Euclid’s algorithm on the inputs 224 and 63 to find gcd(224, 63). [10 marks]

docsity.com

  1. Find a solution to the fractional knapsack problem with the items in the table below, i.e. one that maximizes the total benefit where we can take arbitrarily-sized pieces of each item. The maximum weight allowed in the knapsack is W = 15. Give both the collection of items taken, and the benefit that those items achieve. Please give some reasoning behind your solution (showing your solution process will suffice). [20 marks]

item a b c d e f weight 2 1 3 6 4 5 benefit 3 4 5 18 10 6

  1. For the directed graph in question 5 below, are the vertices D and G in the same strongly connected component? How about vertices H and I? Give some sort of justification for your answer. [20 marks]
  2. Find shortest distances from vertex A to all other vertices in the directed graph below. All edges in the graph have weight 1. Use one of the two methods that we discussed in class to perform this task (either the one based on a BFS or Dijkstra’s algorithm). [20 marks]

docsity.com