Skip to content

Conversation

showmyth
Copy link

@showmyth showmyth commented Oct 4, 2025

Pull Request

Description

This Pull Request aims to add a Job Sequencing with Deadlines algorithm using a greedy approach. This algorithm solves the classic problem of scheduling jobs to maximize profit, where each job has:

  1. A given deadline (i.e., the latest time by which it must complete to generate a profit value)
  2. The said profit value

Algorithm Overview:
We performthe following steps:

  1. Sort all jobs based on their profit in a descending order.
  2. For each job, we attempt to schedule it in the time slot that is availabe at the latest, before its deadline is reached.
  3. If this slot is available, schedule the job or otherwise, skip it.
  4. Return the list of scheduled jobs and total profit achieved.

For "n" no. of jobs
Time Complexity: O(n²)
Space Complexity: O(n)
For more details about the algorithm, see: [Job Sequencing Problem - GeeksforGeeks (https://www.geeksforgeeks.org/dsa/job-sequencing-problem/)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I ran bellow commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I added my algorithm to the corresponding mod.rs file within its own folder, and in any parent folder(s).
  • I added my algorithm to DIRECTORY.md with the correct link.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

Additional Changes/Fixes

  1. Fixed all the clippy warnings thart primarily arised due to using manual modulo (%) operations. (Fixes Replace Manual Modulo (%) checks with .is_multiple_of() #925)
  2. Fixed the redundant parenthesis that was used in the equation of [kl_diveregence_loss.rs (src/machine_learning/loss_function/kl_divergence_loss.rs)

Please make sure that if there is a test that takes too long to run ( > 300ms), you #[ignore] that or
try to optimize your code or make the test easier to run. We have this rule because we have hundreds of
tests to run; If each one of them took 300ms, we would have to wait for a long time.

@showmyth showmyth requested a review from imp2002 as a code owner October 4, 2025 23:00
@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2025

Codecov Report

❌ Patch coverage is 98.76543% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.34%. Comparing base (ed7a42e) to head (18078f9).

Files with missing lines Patch % Lines
src/ciphers/sha3.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #921      +/-   ##
==========================================
+ Coverage   95.32%   95.34%   +0.01%     
==========================================
  Files         319      320       +1     
  Lines       20899    20950      +51     
==========================================
+ Hits        19923    19974      +51     
  Misses        976      976              

☔ 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.

@showmyth showmyth changed the title PR: Implementing Job Sequencing Problem with Deadlines (using Greedy Approach) feat: Added Implemention of Job Sequencing Problem with Deadlines (using Greedy Approach) Oct 6, 2025
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.

Replace Manual Modulo (%) checks with .is_multiple_of()
2 participants