Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am interpreting your question as "the <strong>set</strong> of all optimal solutions must always contain the first choice" otherwise it does not make sense for a solution to contain another solution.</p> <p>Naturally, the answer is trivially yes. If a greedy algorithm solves the problem, it produces an optimal solution, which by definition is in the set of optimal solutions.</p> <p>Perhaps you meant "if a greedy algorithm <em>sometimes</em> produces an optimal solution, ..." in that case again the answer is trivial.</p> <p>If you meant that "if a greedy algorithm <em>sometimes</em> produces an optimal solution, is it true that all guaranteed optimal algorithms will produce that solution too?" the answer depends upon whether the problem has a unique optimal solution or multiple ones.</p> <p>If a problem has multiple optimal solutions, the answer is clearly no.</p> <p>A good example to think about is to sort a list of numbers such that all single digit numbers come ahead of two digit numbers, two digit numbers come ahead of three digit numbers, and so forth. I. e. you don't care whether 99 comes before 11 or vice versa, you just want 9 to come before 25, and 33 before 872, and 555 before 1234.</p> <p>This example problem has multiple optimal solutions. A lazy but not greedy algorithm would not ensure that 11 comes before 99. An overenthusiastic algorithm would do so. Both would produce optimal solutions different from each other.</p> <p>If this doesn't help, nothing will ;-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload