This preview shows pages 1–2. Sign up to view the full content.
1
CSE 421
Algorithms
Richard Anderson
Lecture 7
Greedy Algorithms
Greedy Algorithms
• Solve problems with the simplest possible
algorithm
• The hard part: showing that something
simple actually works
• Pseudodefinition
– An algorithm is
Greedy
if it builds its solution
by adding elements one at a time using a
simple rule
Scheduling Theory
• Tasks
– Processing requirements, release times,
deadlines
• Processors
• Precedence constraints
• Objective function
– Jobs scheduled, lateness, total execution time
• Tasks occur at fixed times
• Single processor
• Maximize number of tasks completed
• Tasks {1, 2, . . . N}
• Start and finish times, s(i), f(i)
Interval Scheduling
What is the largest solution?
Greedy Algorithm for Scheduling
Let T be the set of tasks, construct a set of independent tasks I,
A is the rule determining the greedy algorithm
I = { }
While (T is not empty)
Select a task t from T by a rule A
Add t to I
Remove t and all tasks incompatible with t from T
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 02/25/2012 for the course CSE 421 taught by Professor Richardanderson during the Fall '06 term at University of Washington.
 Fall '06
 RichardAnderson
 Algorithms

Click to edit the document details