Activity Scheduling Problem

In this lesson, we go through a simple problem and solve it with the Greedy Approach.

Problem Statement

Say you are given nn activities with their start and finish times. Select the maximum number of activities that can be performed by a single person, assuming that a person can only work on a single activity at a time.

Mathematically, Let SS == 1,2,...,n{1, 2, . . . , n} be the set of activities that compete for a resource. Each activity ii has its starting time sis_i and finish time fif_i with sis_i fif_i , namely, if selected, i takes place during time [sis_i , fif_i). No two activities can share the resource at any time point. We say that activities ii and jj are compatible if their time periods are disjoint.

The activity-selection problem is the problem of selecting the largest set of mutually compatible activities.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy