Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3794184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:53:26+00:00 2026-05-19T12:53:26+00:00

The problem is this: Need to perform n jobs, each characterized by a gain

  • 0

The problem is this:

Need to perform n jobs, each characterized by a gain {v1, v2,. . . , vn}, a time required for its implementation {t1, t2,. . . , tn} and a deadline for its implementation {d1, d2,. . . , dn} with d1<=d2<=…..<=d3. Knowing that the gain occurs only if the work is done by that time and that you have a single machine. Must describe an algorithm that computes the maximum gain that is possible to obtain.

I had thought of a recurrence equation with two parameters, one indicating the i-th job and the other shows the moment in which we are implementing : OPT(i,d) , If d+t_i <= d then adds the gain t_i. (then a variant of multiway choice ..that is min for 1<=i<=n).

My main problem is: how can I find jobs that previously were carried out? I use a data structure of support?

As you would have written the equation of recurrence?

thanks you!!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:53:27+00:00Added an answer on May 19, 2026 at 12:53 pm

    My main problem is: how can I find jobs that previously were carried out? I use a data structure of support?
    The trick is, you don’t need to know what jobs are completed already. Because you can execute them in the order of increasing deadline.

    Let’s say, some optimal solution (yielding maximum profit) requirers you to complete job A (deadline 10) and then job B (deadline 3). But in this case you can safely swap A and B. They both will still be completed in time and new arrangement will yield the same total profit.
    End of proof.

    As you would have written the equation of recurrence?
    You already have general idea, but you don’t need a loop (min for 1<=i<=n).

    max_profit(current_job, start_time)
        // skip this job
        result1 = max_profit(current_job + 1, start_time)
    
        // start doing this job now
        finish_time = start_time + T[current_job]
        if finish_time <= D[current_job]
            // only if we can finish it before deadline
            result2 = max_profit(current_job + 1, finish_time) + V[current_job];
        end
    
        return max(result1, result2);
    end
    

    Converting it to DP should be trivial.

    If you don’t want O(n*max_deadline) complexity (e.g., when d and t values are big), you can resort to recursion with memoization and store results in a hash-table instead of two-dimensional array.

    edit
    If all jobs must be performed, but not all will be paid for, the problem stays the same. Just push jobs you don’t have time for (jobs you can’t finish before deadline) to the end. That’s all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problem is this: I have multiple competing threads (100+) that need to access
Ive got this problem: Line 20 (LOOT_FromContainer(container) I need that to use as Invoke
I have the problem that I will have multiple servers that perform jobs. They
So my problem is like this; in C# code, I need to perform multiple
My basic Java problem is this: I need to read in a file by
I need to solve a locking problem for this scenario: A multi CPU system.
Need some help with this problem in implementing with XSLT, I had already implemented
I need some help in solving this problem. We have a large amount of
I need to ask what is the problem in this my menu program,when i
i need your help badly because i cannot solve this problem on my own.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.