

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The solutions to midterm 2 of cs 373, fall 2000. The exam covers various graph algorithms, including depth-first search, breadth-first search, shortest path, minimum spanning tree, and connected acyclic graphs. Additionally, it includes a problem on finding the safest path in a probabilistic graph using the knuth-morris-pratt algorithm with wildcard characters.
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!
CS 373 Midterm 2 (October 31, 2000) Fall 2000
(a) a depth-first search tree, starting at the top vertex; (b) a breadth-first search tree, starting at the top vertex; (c) a shortest path tree, starting at the top vertex; (d) the minimum spanning tree.
(^104)
6 1
7
8 9 5
0
3
12 11
2
12 14
2
8 5 10 2 3 18 16
14
30
4 26
8 5 10 3 18 16 12 30
4 26
The minimum spanning tree and the second-minimum spanning tree of a graph.
CS 373 Midterm 2 (October 31, 2000) Fall 2000
Mulder and Scully have computed, for every road in the United States, the exact probability that someone driving on that road won’t be abducted by aliens. Agent Mulder needs to drive from Langley, Virginia to Area 51, Nevada. What route should he take so that he has the least chance of being abducted? More formally, you are given a directed graph G = (V, E), where every edge e has an inde- pendent safety probability p(e). The safety of a path is the product of the safety probabilities of its edges. Design and analyze an algorithm to determine the safest path from a given start vertex s to a given target vertex t.
Memphis, TN^ Langley, VA
Las Vegas, NV
Area 51, AZ
With the probabilities shown above, if Mulder tries to drive directly from Langley to Area 51, he has a 50% chance of getting there without being abducted. If he stops in Memphis, he has a 0. 7 × 0 .9 = 63% chance of arriving safely. If he stops first in Memphis and then in Las Vegas, he has a 1 − 0. 7 × 0. 1 × 0 .5 = 96.5% chance of being abducted!^1
Both wild cards can occur in a single pattern. For example, the pattern f*a?? matches the strings face, football, and flippityfloppitydingdongdang. On the other hand, neither wild card can occur in the text. Describe how to modify the Knuth-Morris-Pratt algorithm to support patterns with these wild cards, and analyze the modified algorithm. Your algorithm should find the first substring in the text that matches the pattern. An algorithm that supports only one of the two wild cards is worth 5 points.
(^1) That’s how they got Elvis, you know.