Greedy Proofs

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/23

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

24 Terms

1
New cards

What is greedy algorithm’s partial solution suppose to prove?

That is is at least as good as any optimal solutions partial solution

2
New cards

What is the “greedy stays ahead” algorithm similar to?

Thjink of it like a race: the greedy choice always stays ahead

3
New cards

Give some example of what “ahead” could mean.

Earlier finish time, smallest cost so far, more tasks scheduled

4
New cards

What are the 4 things to look out for that will let you know when to use “greedy stays head”?

You can compare prefix-by-prefix progress.
The greedy solution and optimal solution build solutions in the same order.
It’s natural to define a partial measure of progress.
The greedy criterion relates directly to an ordering rule (sort-by…).

5
New cards

What are some classic problems using GSA?

  • Interval scheduling (sort by earliest finish time)

  • Scheduling to minimize lateness

  • Minimizing average completion time (sort by shortest processing time)

6
New cards

What is the exchange argument trying to show?

Show that any optimal solution can be gradually transformed into the greedy solution without making it worse.

7
New cards

What is a hint for exchange?

Think of it as:
"if your optimal solution doesn't follow the greedy choice, swap something to make it follow greedy — and don't lose optimality."

8
New cards

What should you use exchange?

Use an exchange argument when:

The greedy choice makes sense locally but does not naturally create a prefix-by-prefix ordering.
You can “fix” any optimal solution that violates the greedy rule.
Feasible swaps exist.
The solution is more like a set (not inherently ordered by time or progress).

9
New cards

What are some classic problems using Exchange Arguments?

  • Minimum Spanning Tree (Kruskal’s / Prim’s)

  • Activity selection (also works with stays-ahead, but exchange is very common)

  • Scheduling to minimize weighted completion time

  • Fractional knapsack

Proof of optimality of greedy set cover heuristic (partial)

10
New cards

What should you use when you want to compare partial progress (prefixes) between greedy and optimal?

Stays Ahead

11
New cards

What should you use when the solution is an unordered set where swaps make sense?

Exchange

12
New cards

What do you use when greedy makes a local choice that isn’t about order but about structure (e.g., minimum edge)?

Exchange

13
New cards

What do you use when you can identify the “first place” where optimal and greedy differ and fix it?

Exchange

14
New cards

What should you use if the greedy action involve sorting and choosing the first valid item?

Stays Ahead because sorted order —> natural prefix structure

15
New cards

You want stay ahead when problems involve:

Problems involving line-like order (distance along a road, time, deadlines)

→ Stays-ahead

Problems where greedy pushes forward in a sequence

→ Stays-ahead

Problems involving “first, second, third...” decisions

→ Stays-ahead

Problems where you can compare greedy’s i-th choice to optimal’s i-th

→ Stays-ahead is expected.

16
New cards

More stay ahead examples include:

  • Gas station problem (this one)

  • Interval scheduling (earliest finish time)

  • Scheduling to minimize lateness

  • Fractional knapsack

  • Minimizing average completion time (SPT rule)

  • Anything involving “go as far as possible” or “earliest something”

17
New cards

It is exchange when:

  • There is no natural order of choices

  • The solution is a set, not a sequence

  • Partial solutions are not meaningful

Swapping is possible

18
New cards

Examples of exchange are:

  • Minimum Spanning Tree (Kruskal/Prim)

  • Set cover style arguments

  • Matroid greedy proofs

Scheduling problems with weighted objectives (if ordering isn’t simple)

19
New cards
20
New cards
21
New cards
22
New cards
23
New cards
24
New cards