Analysis of Algorithms, 91

Analysis of Algorithms, 91

<p>UML CS Analysis of Algorithms 91.404 (section 201) Fall, 2002</p><p>Homework Set #9 </p><p>Assigned: Monday, 12/2 Due: Friday, 12/13 (start of lecture) This assignment covers textbook material in Chapters 15-16 and 22-24. Note: Partial credit for wrong answers is only given if work is shown.</p><p>Part 1: Chapters 15-16 (Algorithmic Paradigms for Optimization Problems) </p><p>1. (20 points) Dynamic Programming: Find an optimal parenthesization of a matrix-chain product whose sequence of dimensions is: <13, 10, 2, 6, 11, 8>.</p><p>2. (20 points) Dynamic Programming: Textbook, Exercise 15.3-5, p. 350.</p><p>3. (30 points) Greedy Algorithms: Textbook, Exercise 16.2-3, p. 384. Provide pseudocode, correctness justification, and worst-case run-time analysis.</p><p>4. (5 points) Greedy Algorithms: What is an optimal Huffman code for the following set of frequencies? A: 5 B: 16 C: 7 D: 2 E: 8 F: 10 G: 23 H: 4</p><p>Part 2: Chapter 22 (Elementary Graph Algorithms) </p><p>5. (15 points) Breadth-First Search: For the undirected graph G1 in Figure 1: a) (5 points) Show an adjacency list representation in which nodes are listed in lexicographic order.</p><p> b) (10 points) Draw the Breadth-First Search spanning forest of trees consisting of tree edges C D that result from a Breadth-First Search of the graph with node A as the source. F c) (5 points) For each node, show the shortest path from A to that node. Give B A the length (i.e. number of edges) of each such shortest path. E Figure 1: G1 6. (15 points) Depth-First Search: For the directed graph G2 in Figure 2: a) (5 points) Show an adjacency matrix representation in which nodes are listed in lexicographic order. b) (10 points) Draw the Depth-First Search spanning forest of trees that result from a Depth-First Search of the graph. Classify and label each edge as either a tree C D edge, back edge, forward edge, or cross edge. F B c) (5 points) Does the graph G2 contain a cycle? If G2 contains a cycle, list A E vertices in the order in which they appear in one of the cycles. If G2 does not contain a cycle, explain how you arrived at this conclusion. Figure 2: G2</p><p>1 UML CS Analysis of Algorithms 91.404 (section 201) Fall, 2002</p><p>7. (5 points) Topological Sort: What is the result of executing a Topological Sort on the directed graph G2 of problem 2? Explain your answer.</p><p>2 C D Part 3: Chapter 23 (Minimum Spanning Trees) 9 2 5 6 F B 7 8 8. (15 points) Show the Minimum Spanning Tree resulting from executing Kruskal’s A E algorithm on the weighted, undirected graph G3 in Figure 3. What is the total Figure 3: G3 weight of the edges in this Minimum Spanning Tree?</p><p>Part 4: Chapter 24 (Single-Source Shortest Paths) 2 C 9 D 9. (25 points) For the weighted, directed graph G4 in Figure 4: 2 5 6 F Execute Dijkstra’s algorithm using vertex B as the source. - B 7 - In the style of Figure 24.6 on p. 596, for each vertex v show the distance values A 8 E (d[v]) and the vertices along each shortest path ([v]) from A to v. Figure 4: G4</p><p>2</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us