Question

Give an example of a problem for which the greedy algorithme does not work even though on first sight it could lead to an opt

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Examples of such greedy algorithms are Kruskal's algorithm and Prim's algorithm for finding minimum spanning trees, and the algorithm for finding optimum Huffman trees.

Add a comment
Know the answer?
Add Answer to:
Give an example of a problem for which the greedy algorithme does not work even though...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • There is no known Greedy strategy that is optimal for solving the 0/1 Knapsack problem. For...

    There is no known Greedy strategy that is optimal for solving the 0/1 Knapsack problem. For each of the following strategies give a counterexample, i.e. descibe an instance where that strategy will fail to produce an optimal result. (a) Lightest item first. (b)Most valuable item first. (c)Item with the best value to weight ratio first.

  • For given capacity of knapsack W and n items {i1,i2,...,in} with its own value {v1,v2,...,vn} and...

    For given capacity of knapsack W and n items {i1,i2,...,in} with its own value {v1,v2,...,vn} and weight {w1,w2,...,wn}, find a greedy algorithm that solves fractional knapsack problem, and prove its correctness. And, if you naively use the greedy algorithm to solve 0-1 knapsack problem with no repetition, then the greedy algorithm does not ensure an optimal solution anymore. Give an example that a solution from the greedy algorithm is not an optimal solution for 0-1 knapsack problem.

  • Consider the following greedy algorithm for the knapsack problem: each time we pick the item with...

    Consider the following greedy algorithm for the knapsack problem: each time we pick the item with the highest value to weight ratio to the bag. Skip items that will make the total weight exceeded the capacity of the bag. Find a counterexample to show that this approach will not work, and the result could be 100 times worse than the optimal solution. That is, construct a table of set of items with weight and values and find a bag capacity...

  • 5) Which of the following is/are true? (2pts) I) a brute force algorithm will always give...

    5) Which of the following is/are true? (2pts) I) a brute force algorithm will always give you the optimal solution Il) since greedy algorithms make locally optimal choices, they are always guaranteed to find the best possible solution to an optimization problem IlI) brute-force solutions generally run slower than greedy algorithms a) I and lIl b)1 and IlI c) Il and III d) Ill only e) I, I and llI

  • "Greedy, but Better": Given a knapsack problem with a weight capacity C, and n items, and...

    "Greedy, but Better": Given a knapsack problem with a weight capacity C, and n items, and each item has a weight W[1:n] and monetary value P[1:n]. You have to determine which items to take so that the total weight is C, and the total value (profit) is maximized. In this case we are considering an integer problem, so you can either take an item, or not take an item, you cannot take it fractionally. If you recall, the greedy algorithm...

  • The test for sulfate used in lab may give a false positive. Even though there is...

    The test for sulfate used in lab may give a false positive. Even though there is no sulfate, the precipitate may form. However, the test for phosphate does not give a false positive. Explain why the test for phosphate does NOT give a false positive, whereas the sulfate test may give a false positive. Sulfate tests: Na2SO4(aq) + BaCl2(aq) --> BaSO4(S)2NaCl(aq) ---True positive 2Na3PO4(aq) + 3BaCl2(aq) --> Ba3(PO4)2(S) + 6NaCl(aq) ---False positive Phosphate tests: 2Na3PO4(aq) + 3Mg(NO3)2(aq) --> Mg3(PO4)2(S) +...

  • Give an example of a spring system whose motion would be described by the solution to...

    Give an example of a spring system whose motion would be described by the solution to the following initial value problem. Make sure to include units (you can choose whatever units you like, but they have to make sense and be consistent which each other). 21 x′′ + 12 x′ + 6x = 3 cos(2t) x(0) = −2 x′(0) = −1 (In other words: I am asking you to work backwards and give an example of a word problem that...

  • Give pseudocode that performs the traceback to construct an LCS from a filled dynamic programming table...

    Give pseudocode that performs the traceback to construct an LCS from a filled dynamic programming table without using the “arrows”, in O(n + m) time. 2. Suppose we are given a “chain” of n nodes as shown below. Each node i is “neighbors” with the node to its left and the node to its right (if they exist). An independent set of these nodes is a subset of the nodes such that no two of the chosen nodes are neighbors....

  • example of this principle at 21. A) What is the principle of allocation? B) Give an...

    example of this principle at 21. A) What is the principle of allocation? B) Give an work in relation to (i) optimal foraging, (ii) life history traits, and (ii) competitive ability 22. A) What is meant by "prey switching"? B) Explain how this phenomenon could contribute to maintaining high species diversity within a community example of this principle at 21. A) What is the principle of allocation? B) Give an work in relation to (i) optimal foraging, (ii) life history...

  • How does adding water to antimony trichloride affect (shift) the equilibrium even though it doesn't show...

    How does adding water to antimony trichloride affect (shift) the equilibrium even though it doesn't show up on the equalibrium constant expression? Is it because it dilutes the concentrations of the Cl- ions? Which way does it shift? SbCl3 (aq) + H20(l) <---> SbOCl(s) + 2H+(aq) + Cl-(aq)

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT