PART 1: PSEUDO-CODE Let J be a set of jobs that need to be processed on a single
ID: 3751215 • Letter: P
Question
PART 1: PSEUDO-CODE Let J be a set of jobs that need to be processed on a single machine. Let pj and d, be the processing time and due date of job j in J. Assume the following inputs: j0, 1, 2, 3, 4, 51 P [10, 3, 4, 8, 10, 6] d-[15, 6, 9, 23, 20, 30 due dates jobs (index) processing times Problem #2-20 points Develop a pseudo-code that reads the lists j, p and d as inputs and prints a list with the indexes of the jobs that are completed late if the jobs are processed in non-decreasing order of their index (ie. 0 1 2 ).Explanation / Answer
Solution:
This solution having explanation ,approach to solve the problem
for your clear and better understanding.
EXPLANATION:
Before going to direct answer first let's see the approach for solving
this problem.
As first of all we have to take input as list for j,p and d.
THen since the job which will take the most processing time
will be completed late if processing time is different.
if the processing time is same then check for maximum late due date.
So the idea to solve this, first of all sort the all other two
list with resepect to processing time.
Now make a loop for i=1 to lastIndex
and check which is going to complete late.
Now for more visualizing see the below:
Pseudo Code :
1.Take input of three list
j=list()
P=list()
d=list()
Now sort the p in descending order , j and d will be move accordingly.
sort(p)
make a loop from i=startIndex to LastIndex
inside =0;
index;
for i=0 to LastIndex
begin
index=i;
for j=i to lastIndex-1
begin
Inside =1;
check whether p[j] ==p[j+1]
if equal then find max([d[j]],d[j+1])
and index=index of max([d[j]],d[j+1])
end
if inside=1
print max
print index
else
print p[i]
print index;
end
since pseuso code is provided in a simpler way for your full understanding .
However apart from this if any difficulty in understanding the above then feel
free to ask.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.