206k views
3 votes
When the famous stylist Kate Young comes to her office, she sees that her customers Anna (A), Bella (B) and Chloe (C) are waiting for her service. A needs a service that takes 5 minutes, B requires a service that takes 20 minutes and C requires a service that takes 10 minutes. Kate Young wants to schedule the customers in such a way that minimizes their total time in the system. What should be the heuristic that Kate Young uses for her greedy algorithm to minimize the total time in the system

User Nagham
by
3.1k points

1 Answer

1 vote

Answer:

The heuristic would be to satisfy the shortest time first. so it would be in this order

Anna first,

Chloe second,

Bella last.

Step-by-step explanation:

The heuristic that Kate should use for her greedy algorithm in order to minimize the total time in the system would be to satisfy the job that is shortest first.

The shortest job first heuristic would be used here. so we arrange the service time for all customers according to ascending order. First Kate would attend to since Anna needs a service that would take 5 minutes, then Chloe would be next with 10 minutes and lastly Bella would next with as service time of 20 minutes.

i have gone ahead to help you calculate the total waiting time

The total waiting time would

for Anna = 0 minutes since she is first

for Chloe it would be the time Anna spent receiving her service = 5 minutes

for Bella: it would be the time Anna spent receiving her service in addition to Chloe's time= 5+10 = 15

total waiting time = 5 + 15 minutes = 20 minutes.

User Tammie
by
3.6k points