Activity selection problem

11

Transcript of Activity selection problem

Page 1: Activity selection problem
Page 2: Activity selection problem
Page 3: Activity selection problem
Page 4: Activity selection problem
Page 5: Activity selection problem
Page 6: Activity selection problem
Page 7: Activity selection problem
Page 8: Activity selection problem

Activity-selection Problem

Page 9: Activity selection problem

Example:

A :

Page 10: Activity selection problem

Define the Problem

Page 11: Activity selection problem

Top-down Greedy Algorithm

• Goal: to compute max activity• Pseudo-code– Rec-Job-Select( s,f, i, n ) m = i + 1

while (m ≤ n) and ( < ) do m = m + 1

if m ≤ n return { } Rec-Job-Select(s, f, m, n) else return

sm

fi

am