Skip to content

Conversation

@AliAlimohammadi
Copy link
Contributor

Description

Adds implementation of the Task Assignment Problem using bitmasking and dynamic programming.

Problem Statement

Given:

  • N tasks to be performed
  • M people who can perform tasks
  • Each person can perform only certain tasks
  • Each person can perform at most one task
  • Each task can be performed by at most one person

Find the total number of valid task assignments where all people are assigned tasks.

Algorithm

  • Uses bitmasking to represent which people have been assigned tasks
  • Uses dynamic programming to cache subproblem results
  • Recursively tries assigning each task to capable people

Complexity

  • Time: O(2^M * N) where M is number of people, N is number of tasks
  • Space: O(2^M * N) for the DP table

Example

let task_performed = vec![vec![1, 3, 4], vec![1, 2, 5], vec![3, 4]];
let total_tasks = 5;
let ways = count_task_assignments(task_performed, total_tasks);
// Returns: 10 valid assignments

Checklist

  • Code follows Rust style guidelines (rustfmt)
  • No clippy warnings
  • All tests pass
  • Added comprehensive test cases
  • Documentation is complete
  • Updated DIRECTORY.md
  • Updated mod.rs

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.44%. Comparing base (13710a7) to head (8bacaef).

Files with missing lines Patch % Lines
src/dynamic_programming/task_assignment.rs 98.07% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #958      +/-   ##
==========================================
+ Coverage   95.39%   95.44%   +0.05%     
==========================================
  Files         332      333       +1     
  Lines       21496    21548      +52     
==========================================
+ Hits        20506    20567      +61     
+ Misses        990      981       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants