Skip to content

Conversation

@Caktusuki
Copy link

Summary

Adds activity_selection.py implementing the greedy activity selection algorithm.
Selects the maximum set of non-overlapping activities by sorting on finish times.

Changes

New file: activity_selection.py
activity_selection(start_times, finish_times) — returns list of selected activity indices.
Includes two example test cases under if name == "main": with sample input and printed output.
Small README note (optional) explaining how to run the script.

How to test

python activity_selection.py

Expected output:

Selected activities (indices): [ ... ]

Number of activities selected: ...

Notes for reviewers

Algorithm mirrors canonical greedy solution; uses sorting by finish time.
Input lists must be same length; no extra validation to keep the example beginner-friendly.
Happy to update to return selected activities sorted by finish time or swap to zero/one-based indices if preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant