You are on page 1of 20

4.

G REEDY A LGORITHMS I
earliest-finish-time-first algorithm demo

Lecture slides by Kevin Wayne


Copyright 2005 Pearson-Addison Wesley
Copyright 2013 Kevin Wayne
http://www.cs.princeton.edu/~wayne/kleinberg-tardos

Last updated on Sep 8, 2013 6:19 AM

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H

time

10

11

10

11
2

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

job B is compatible (add to schedule)

B
0

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

B
0

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

job C is incompatible (do not add to schedule)

B
0

C
3

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

B
0

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

job A is incompatible (do not add to schedule)

B A
0

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

B
0

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

job E is compatible (add to schedule)

B
0

E
3

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

B
0

time

10

11

10

11

E
3

10

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

job D is incompatible (do not add to schedule)

B
0

D
E
3

11

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

B
0

time

10

11

10

11

E
3

12

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

job F is incompatible (do not add to schedule)

B
0

E
3

F
6

13

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

B
0

time

10

11

10

11

E
3

14

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

job G is incompatible (do not add to schedule)

B
0

E
3

15

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time

10

11

10

11

job G is incompatible (do not add to schedule)

B
0

E
3

G
6

16

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

B
0

time

10

11

10

11

E
3

17

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time
10

11

10

11

job H is compatible (add to schedule)

B
0

E
3

H
6

18

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

B
0

E
3

time
10

11

10

11

H
6

19

Earliest-finish-time-first algorithm demo

B
C

A
E
D
F
G
H
0

time
10

11

10

11

done (optimal set of jobs)

B
0

E
3

H
6

20