DEV Community

Rishi Raj
Rishi Raj

Posted on

1 1

Scheduling Algorithm

This Python Notebook (https://github.com/rishiraj824/scheduling/blob/master/scheduling.ipynb) demonstrates the scheduling algorithm for a list of activities provided through a CSV. It uses the dynamic programming approach to solve for the most compatible activities.

The above solution works for any given activity board as it takes into account the maximum earnings from those activities.

Step 1.
We first sort all our activities based on their finish times and compare the activities one by one to find the next compatible activity because activities cannot overlap each other.

Step 2.
We use a binary search to find the most compatible activity. This takes us O(lg n) time.

Step 3.
We do this n times and while we do this we save the activity names to output all the possible activities in the end.

Step 4.
Keep adding the reward of all the compatible, highest rewards and display the sum in the end.

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay