4 ms·
I can see a lot of cases where someone gets stuck in the queue and is never served. It's quite possibly (and even likely) last in first out provides the lowest
by theluketaylor 11y ago
I can see a lot of cases where someone gets stuck in the queue and is never served. It's quite possibly (and even likely) last in first out provides the lowest average wait time but it would come at the expense of the outliers. First in first out is the standard for lining up with people because it provides the lowest deviation from the average. It's the most fair system for everyone involved because you wait from the back to the front just like everyone else, no special cases.
Optimizing FIFO is easy as well: just go when other people are less likely to be there. There is incentive to shop for christmas Dec 1 since Dec 23 the mall is a mad house. I did my grocery shopping when I worked graveyard shift at 2 AM on my weekend with 24 hr grocery store since the place was deserted. I stroll out for lunch at 11:30 AM and beat the rush at the food trucks. Not everyone has the flexibility to shop at 2 AM or shift lunch time but for those who do there is incentive to take advantage. Optimizing LIFO is also easy but awful for those around you. There is no more incentive to find a low volume time; just rock up and stroll past the suckers who tried to beat the rush but just didn't quite do it.
Some common things people line up for:
Low volume shop (ex furniture) - Here you'd never wait that long to pay simply because there are not that many customers. If the cashier is busy customers simply linger longer around the merchandise and wait for availability. No need to make any changes
High volume shop (ex supermarket) - These stores have a steady stream of customers so would be the most likely to get someone stuck in the queue for a long time. If there is a spike in customer numbers for 1/2 hr but then a very steady stream of shoppers for the rest of the day someone could be waiting hours for the queue to dwindle low enough to clear the spike. The steady stream takes up the full cashier capacity leaving the spike waiting for service while their food spoils. If the rate of customer arrival exceeds cashier volume (as it often does during busy times) some people are going to wait in that queue until the rush subsides.
general admission event - Here people pay the same amount for tickets and in FIFO are able to pay extra with their queuing time (since time is money) to indicate how much a good seat is worth to them. In LIFO you would try to arrive as late as possible but the venue can only be filled so quickly so you'd get the reverse of the stadium emptying problem. When everyone gets up to leave at end the exits become a massive bottleneck and everything slows down. If being late means you skip to the front of the queue everyone will arrive late and the event won't start on time since no one will be in their seats when the event is supposed to begin.
I don't doubt there is some math that would indicate average wait times would go down with FIFO but queueing isn't about minimizing the average, it's about minimizing the extremes. Often minimizing the extremes is at the expense of the average. A O(logn) queue sucks if the worst case is O(n^4). Better to have O(n) and fewer stabbings.