Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are m jobs to schedule on n processors. A schedule is balanced if the difference between the number of jobs scheduled on any two

There are m jobs to schedule on n processors. A schedule is balanced if the difference between the number of jobs scheduled on any two neighboring processors does not exceed 1.
The kth processor is the most efficient, and thus, the maximum number of jobs should be scheduled on that processor. Find the maximum number of jobs that can be scheduled on the kth processor, such that the overall schedule remains balanced.
Note: Each processor must have at least one job scheduled
Example
Consider n=5, m =11, k=3.
Explanation:
In each schedule, there are 11 jobs across 5- processors. k assumes 1-based indexing.
The 15t schedule is not balanced because the Sth processor has 1 job scheduled, while the 4th processor has 4 jobs scheduled, their difference is 3, which exceeds 1.
The 5th schedule is not balanced because the difference between the 2nd and 3rd, and between 3rd
3rd and 4th processors is more than 1.
Amongst all balanced schedules, the maximum number of jobs that can be scheduled on the 3rd processor is 3. So, the answer is 3.
Example 2:
Explanation
Given in n=5, m =11, k=5.
One optimal schedule is [1,1,2,3,4]
so 5th process executes 4 jobs maximum. so output is 4
Example 3:
Explanation
Given in n=5, m =16, k=2.
One optimal schedule is [4,4,3,3,2]
so 5th process executes 4 jobs maximum. so output is 4
write a program in java

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions