Recall & Review
beginner
What is the main goal of the Activity Selection Problem?
To select the maximum number of activities that don't overlap in time from a given set of activities.
Click to reveal answer
beginner
Which greedy choice is used in the Activity Selection Problem?
Always pick the activity that finishes earliest among the remaining activities.
Click to reveal answer
beginner
Why do we sort activities by their finish time in the Activity Selection Problem?
Sorting by finish time helps to easily pick the next activity that finishes earliest and does not overlap with previously selected activities.
Click to reveal answer
intermediate
What is the time complexity of the Activity Selection Problem solution using the greedy approach?
O(n log n) due to sorting the activities by their finish time. The selection process itself is O(n).
Click to reveal answer
intermediate
In the Activity Selection Problem, what happens if two activities have the same finish time?
You can choose either one since both finish at the same time; the greedy approach still works correctly.
Click to reveal answer
What is the first step in solving the Activity Selection Problem?
✗ Incorrect
Sorting activities by their finish time allows the greedy algorithm to pick the earliest finishing activity first.
After selecting an activity, what is the next step?
✗ Incorrect
We pick the next activity that starts after the current one finishes to avoid overlap.
What type of algorithm is used to solve the Activity Selection Problem efficiently?
✗ Incorrect
The greedy algorithm works because choosing the earliest finishing activity leads to an optimal solution.
If activities are not sorted, what is the impact on the solution?
✗ Incorrect
Without sorting by finish time, the greedy choice may fail and the solution may not be optimal.
What is the output of the Activity Selection Problem?
✗ Incorrect
The goal is to select the largest number of activities that do not overlap.
Explain the greedy strategy used in the Activity Selection Problem and why it guarantees an optimal solution.
Think about how picking the earliest finishing activity leaves room for more activities.
You got /3 concepts.
Describe the steps to implement the Activity Selection Problem solution in C.
Start with sorting, then pick activities one by one checking start and finish times.
You got /4 concepts.