Lecture 3: Greedy Algorithms
- The schedule is now online.
- HW1 is due on Friday
- If the bookstore is out of course packets, put in a request for one so that they’ll print more. Otherwise you might not get one.
(4.1 - 4.6) Greedy Algorithms:
- Always choose a local optimum
- Stable Marriage is an example of a greedy algorithm
Solving an algorithms problem:
- Give an algorithm
- Give a proof of correctness
- Analyze running time
Interval Scheduling:
Some suggestions for choosing the interval segments. Choose the:
- First to finish
- x Shortest one
- x First left endpoint
- x One with fewest conflicts
S = {segments}
A = {}
while S != {} do
choose s in S with minimum right endpoint
A = A U {s}
delete all s’ in S that overlap with s
end
“The rth interval is at least as good as the rth interval in the optimal set”
A contains no overlapping intervals. Let {i1, … , ik} be the set of segments added to A, in order, and let {j1, … , jk} be the set of segments in O, the optimal solution. Since by our rule f(i1) < = f(j1), we see that we "stay ahead" of the optimal solution at each step by choosing the "shortest" possible segment. This allows us to assume that f(ir-1) < = f(jr-1). We know that f(jr-1) < = s(jr) because all the segments in S are compatible. With our inductive assumption, we can write f(ir-1) < = s(jr), thus jr has not been already selected or eliminated when we choose ir. Since the greedy algorithm chooses the interval with the smallest finish time, we pick one equal or smaller to jr: ir < = jr.
“A is an optimal solution”
By contradiction, if A isn’t optimal, then the optimal set O will have more requests. This would mean that (a) there must be m > k requests, and (b) O makes a k+1th request after both ik and jk end. This means that after deleting all requests that are incompatible with {i1, … , ik} the set of possible requests R still contains jk+1. But the greedy algorithm stops on request ik, and it only stops when R is empty–a contradiction!
This entry was posted on Friday, January 28th, 2005 at 11:29 am and is tagged with greedy algorithms, greedy algorithm, stable marriage, time interval, course packets, optimal solution, finish time, proof of correctness, contradiction, segments, running time, intervals, assumption, lt, conflicts, segment, bookstore, nbsp, marriage. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.
One Response to 'Lecture 3: Greedy Algorithms'
Leave a Reply
Please take time to enjoy the archives: May 2005 (1) April 2005 (11) March 2005 (11) February 2005 (15) January 2005 (7)
Fresh, related resources:
- Big b3/b Automakers Lectured About Excess by Congress When Asking for b.../b
Officials from the Big b3/b automakers got a spanking from Congress Wednesday, some members of which blasted the executives for each taking their own private planes to Washington to testify. - Why the Big b3/b Bailout is Bullshit: Cadillacs Made in China b.../b
"the government should oversee a bankruptcy and make sure GM becomes more efficient"?! The government, by pretty much any standard is the least efficient beast around (by design largely) should blecture/b a private company on efficiency? b.../b - Dealbreaker - A Wall Street Tabloid - Business News Headlines and b.../b
For its part, Wall Street was some combination of too stupid to know better (unlikely) or too bgreedy/b (this horse is favored like 800 to 1) to exhibit any semblance of collective self-restraint insomuch as everyone thought you wouldn?t b.../b - Desicritics.org: Swami and His Foes
He opened his blecture/b praising the U.S. from where he had returned, after a long and fruitful visit. He said, 'I was discussing with few young Americans about Indian culture and our ancient practices aimed at healthy living. b.../b - bAlgorithms/b (F2008) » Blog Archive » blecture/b 17: more approximations
We covered material from Chapter 11 of KT, and considered two examples: Firstly, we looked at a simple scheduling problem and showed how to get a 2-approximation using a bgreedy algorithm/b. Then, we looked at the Travelling Salesman b.../b

on May 14th, 2005 at 9:42 pm
[…] ts until done. Proof proceeds by “stays ahead” argument. See lecture 3 for a proof of optimality. Interval P […]