Assume that we have the arrival times and the service times that each customer will require in a single server queue. If we use a FIFO strategy, we can calculate the departure times using the following code:
departures[0] = arrivals[0] + services[0]
for i in range(1, n):
if arrivals[i] < departures[i-1]:
departures[i] = departures[i-1] + services[i]
else:
departures[i] = arrivals[i] + services[i]
What if there is a LIFO strategy, i.e, when the server completes a service, the next customer to enter service is the last to join the line. I have trouble coding this one in python and I appreciate your help.