Activity selection problem

Post on 11-Apr-2017

261 views 0 download

Transcript of Activity selection problem

Activity-selection Problem

Example:

A :

Define the 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