Question
Question 3: Given a gas station with two pumps, A and B , and a collection of cars S = { 1 , 2 ,
Question 3: Given a gas station with two pumps, A and B , and a collection of cars S = { 1 , 2 , . . . , n } with filling time s i for item i (on both pumps the filling time is the same). Give an algorithm that divides S to two disjoint sets X, Y so that X Y = S and X Y = , and so that A fills gas for the cars in X , and B fills the cars of Y , in parallel, so that the time all the gas filling ends is minimum. Example: If X = { 3 , 4 , 2 } and Y = { 5 , 2 , 3 } the ending time is 10 as 5 + 2 + 4 = 10 which is larger than 3 + 4 + 2 = 9. please give only pseudocode.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started