Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE) PDF Download

Given an array of jobs where every job has a deadline and associated profit if the job is finished before the deadline. It is also given that every job takes a single unit of time, so the minimum possible deadline for any job is 1. How to maximize total profit if only one job can be scheduled at a time.

Examples:
1. Input: Four Jobs with following 

deadlines and profits
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Output: Following is maximum
profit sequence of jobs
        c, a

2. Input:  Five Jobs with following
deadlines and profits
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Output: Following is maximum
profit sequence of jobs
        c, a, e

A Simple Solution is to generate all subsets of a given set of jobs and check individual subsets for the feasibility of jobs in that subset. Keep track of maximum profit among all feasible subsets. The time complexity of this solution is exponential. 

This is a standard Greedy Algorithm problem.
Following is the algorithm:

  1. Sort all jobs in decreasing order of profit.
  2. Iterate on jobs in decreasing order of profit.For each job , do the following :

(i) For each job find an empty time slot from deadline to 0. If found empty slot put the job in the slot and mark this slot filled.
The Following is the implementation of the above algorithm.
C++
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Java
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Python3
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Javascript
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)
Output
Following is maximum profit sequence of jobs
c a e

The Time Complexity of the above solution is O(n2). It can be optimized using Disjoint Set Data Structure. Please refer to the below post for details.

The document Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Algorithms.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
81 videos|80 docs|33 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Job Sequencing Problem - Algorithms - Computer Science Engineering (CSE)

1. What is the job sequencing problem in Computer Science Engineering (CSE)?
Ans. The job sequencing problem in CSE refers to a problem where a set of jobs with different deadlines and profits needs to be scheduled for execution. The objective is to maximize the overall profit by completing the jobs within their respective deadlines.
2. How is the job sequencing problem solved in Computer Science Engineering (CSE)?
Ans. The job sequencing problem is typically solved using algorithms such as Greedy Algorithms or Dynamic Programming. Greedy algorithms prioritize jobs based on certain criteria, such as the highest profit or the earliest deadline. Dynamic programming, on the other hand, breaks the problem into subproblems and solves them recursively to find an optimal solution.
3. What is the complexity of solving the job sequencing problem in Computer Science Engineering (CSE)?
Ans. The complexity of solving the job sequencing problem depends on the algorithm used. For example, the complexity of solving it using a Greedy Algorithm is O(n log n), where n is the number of jobs. Dynamic programming algorithms may have a complexity of O(n^2) or O(n^3) depending on the specific implementation.
4. What are the applications of the job sequencing problem in Computer Science Engineering (CSE)?
Ans. The job sequencing problem has various applications in CSE. It is commonly used in task scheduling, production planning, resource allocation, and project management. By efficiently sequencing jobs, companies can optimize their resource utilization, meet deadlines, and maximize profits.
5. Can the job sequencing problem in Computer Science Engineering (CSE) have multiple optimal solutions?
Ans. Yes, the job sequencing problem can have multiple optimal solutions. Depending on the specific criteria used for job prioritization, different sequences of jobs may yield the same maximum profit. However, the overall objective of maximizing profit while meeting deadlines remains the same.
81 videos|80 docs|33 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Extra Questions

,

Exam

,

Previous Year Questions with Solutions

,

Semester Notes

,

MCQs

,

pdf

,

Sample Paper

,

Summary

,

Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)

,

Free

,

Objective type Questions

,

study material

,

Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)

,

practice quizzes

,

mock tests for examination

,

video lectures

,

Important questions

,

past year papers

,

Job Sequencing Problem | Algorithms - Computer Science Engineering (CSE)

,

shortcuts and tricks

,

Viva Questions

,

ppt

;