Hacker News new | ask | show | jobs
by jon889 887 days ago
Why don't you just scan the alcohol last then?
1 comments

Because you still need to wait for the attendant to come. But you have no chance of scanning other items in parallel. (Assuming you don't know if this store will block scanning)

It is always optimal to scan these first. You have two cases:

Blocking: scan 1 + wait for attendant + scan rest

Non-blocking: scan 1 + max(wait for attendant, scan rest)

However if you scan these items last the wait is always the same:

scan rest + scan 1 + wait for attendant

This is never shorter than either of the previous two. It is equivalent to the blocking case and almost always longer than the non-blocking case.

^ This post is just in case you forgot you were on hacker news.
I agree it's a beautifully crafted response, and have nothing to add, it's exactly what my point was.