Activity Selection Problem
Activity Selection Problem
5 9 A1
1 2 A2
3 4 A3
0 6 A4
5 7 A5
8 9 A6
• Step 1: Sort the given activities in ascending order
according to their finishing time.
The table after we have sorted it:
1 2 A2
3 4 A3
0 6 A4
5 7 A5
5 9 A1
8 9 A6
• Step 2: Select the first activity from sorted
array act[] and add it to the sol[] array, thus sol = {A2}.