This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Algorithms Problem Set: Dynamic Programming and Greedy Method July 25, 2007 1. Reliability: We are given a directed graph G = ( V, E ) on which each edge ( u, v ) E has an associ ated value r ( u, v ) , which is a real number in the range r ( u, v ) 1 that represents the reliability of a communication channel from vertex u to vertex v . We interpret r ( u, v ) as the probability that the channel from u to v will not fail, and we assume that these probabilities are independent. Give an efficient algorithm to find the most reliable path between two given vertices. Write the complete algorithm. Analyze its time complexity. 2. Speech Recognition: We can use dynamic programming on a directed graph G = ( V, E ) for speech recognition. Each edge ( u, v ) E is labeled with a sound ( u, v ) from a finite set of sounds. The labeled graph is a formal model of a person speaking a restricted language. Each path in the graph starting from a distinguished vertex v V corresponds to a possible sequence of sounds produced by the model. The label of a directed path is defined to be the concatenation of the labels of the edges on that path. Describe an efficient algorithm that, given an edgelabeled graph G with distinguished vertex v and a sequence s = ( 1 , , k ) of characters from , returns a path in G that begins at v and has s as its label, if any such path exists. Otherwise, the algorithm should return NOSUCHPATH. Analyze the running time of the algorithm. Clearly write any dynamic programming formulation you may use to solve this problem. 3. Coin Change: In the United States, coins are minted with denominations of 1, 5, 10, 25, and 50 cents. Now consider a country whose coins are minted with denominations { d 1 , d 2 , . . . , d k } of units. They seek an algorithm that will enable them to make change of n units using the minimum number of coins. The greedy algorithm for making change repeatedly uses the biggest coin smaller than the amount to be changed until it is zero. Provide a greedy algorithm for making change of n units using US denominations. Prove its correctness and analyze its time complexity. Show that the greedy algorithm does not always give the minimum number of coins in a country whose denominations are { 1 , 6 , 10 } . Give an efficient algorithm that correctly determines the minimum number of coins needed to make change of n units using denominations { d 1 , d 2 , . . . , d k } . Analyze its running time. 4. Difference of Sums: Give an algorithm for the following problem. Given a list of n distinct positive integers, partition the list into two sublists, each of size n/ 2 , such that the difference between the sums of the integers in the two sublists is minimized. Formulate a dynamic programming definition 1 for the problem. Develop an algorithm based on your definition. What is the time complexity of your algorithm? You can assume that n is a power of 2....
View Full
Document
 Winter '08
 staff
 Algorithms, C Programming

Click to edit the document details