639 B
639 B
Schedule Problem
A single server has n customers to serve. The sere time t_i required by each customer i is known in advance. Goal is to minimize T, the time in the system for customer i.
For example, t_1=5, t_2=10, t_3=3. Schedule 1: 123, Schedule 2: 231
Input: The set C of all customers C = { t_1, ... }. t_i is the service time for customer i Output: The total time in the system for all customers Merge Sort C in ascending order. A greedy solution works in this case.
We can simply run through the sorted list and serve them in order.
But if we assume the greedy algorithm is not optimal in this case Try to reduce total time T