CSC306 Final Exam Autumn’14
1. (10+5)
The diagram below is a weighted graph showing seven computer terminals a,b… g with the figure representing the distance in meters between the various computers. A LAN (Local Area Network) with the minimum length of cabling needs to be set up.
Using Prim’s Algorithm, find the minimal spanning tree, starting from node D, clearly displaying the implementation of the algorithm. Also find the length of the MST.
Suppose that a graph G has a minimum spanning tree already computed. How quickly can the minimum spanning be updated if a new vertex and incident edges are added to G?
2. Write an algorithm to check whether a given graph G is connected or not. Assume the graph is given in the form of an adjacency matrix. (10)
3. Prove that (5+5)
The largest and second largest number from n numbers can be found in no more than n+ |lg(n)| -2 comparisons.
The largest and the smallest number from n numbers can be found in no more than | (3n-4)/2 | comparisons.
4. Prove or Disprove: (5+5) a) 2lgn = Ѳ (n).
b) lg n! = Ѳ (nlgn)