Question: . Design a greedy algorithm for arranging the queuing order in a supermarket. Suppose there are n customers come to the counter at the same

. Design a greedy algorithm for arranging the queuing order in a supermarket. Suppose there are n customers come to the counter at the same time, noted as c1,c2,...,cn, the time to service i-th customer is si, i =1,2,...,n, and the absolute time to finish i-th customer is Ti, i =1,2,...,n. Your goal is to decide a queuing order of n customers to minimize the accumulated completion time (waiting time + service time) of all n customers, that is, to minimize n i=1 Ti.(a) Provide an algorithm to solve this issue; (b) Prove the correctness of your algorithm by showing the greedy choice property and optimal sub structure; (c) Justify the running time of your algorithm.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!