CSCE 221: Data Structures and Algorithms

Sections: 507, 508, 509
Fall 2015



Homework 10.5 (Optional Assignment)


Due Date: Last Day (before class)


Assignment

  1. R13.16 (Pg. 656)

    Show how to modify Dijkstra's algorithm to not only output the distance from v to each vertex in G, but also to output a tree T rooted at v such that the path in T from v to a vertex u is a shortest path in G from v to u. Show the modification in pseudocode, and state its correctness, complexity and its justification.

  2. C13.5 (Pg. 658)

    Tamarindo University and many other schools worldwide are doing a joint project on multimedia. A computer network is built to connect these schools using communication links that form a free tree. The schools decide to install a file server at one of the schools to share data among all the schools. Since the transmission time on a link is dominated by the link setup and synchronization, the cost of a data transfer is proportional to the number of links used. Hence, it is desirable to choose a "central" location for the file server. Given a free tree T and a node v of T, the eccentricity of v is the length of a longest path from v to any other node of T . A node of T with minimum eccentricity is called a center of T .

    1. Design an efficient algorithm that, given an n-node free tree T, computes a center of T. Give the pseudocode, correctness, complexity and its justification.
    2. Is the center unique? If not, how many distinct centers can a free tree have?

  3. C13.16 (Pg. 659)

    Consider the following greedy strategy for finding a shortest path from vertex start to vertex goal in a given connected graph.

    1. Initialize path to start.
    2. Initialize VisitedVertices to {start}.
    3. If start=goal, return path and exit. Otherwise, continue.
    4. Find the edge (start,v) of minimum weight such that v is adjacent to start and v is not in VisitedVertices.
    5. Add v to path.
    6. Add v to VisitedVertices.
    7. Set start equal to v and go to step 3.
    Does this greedy strategy always find a shortest path from start to goal? Either explain intuitively why it works, or give a counter example.


Bonus

    C13.18 (Pg. 659)

    Design an efficient algorithm for finding a longest directed path from a vertex s to a vertex t of an acyclic weighted digraph G. Specify the graph representation used and any auxiliary data structures used. Also, analyze the time complexity of your algorithm.


Grading Rubric

Each homework composes 2% of your final grade. Each homework will be graded out of 100 possible points. In any problem asking you to design an algorithm please also provide proper pseudocode (mathematical notation), complexity analysis (both space and time), and brief justification of complexity and correctness.

All assignments must be turned in with a signed coverpage. If no coverpage is provided, the assignment will not be graded.

If there are any discrepancies in grades please see Jory Denny during his office hours (not the TA or Grader).