Visiting a supermarket with a shopping list, get all items in the fastest way?

Once in a while, my wife sends me to a REAL supermarket, with a shopping list (she writes me an a piece of paper, or texts me a message).

I was wondering is there a fast way to for-fill the list, without iterating the whole super a dozens of times, till I believe I've got everything.

(I found this question very helpful in life: pair-socks-from-a-pile-efficiently, and hoped I can use the community's help in my own situation)

I don't know/remember where each item is located in the supermarket, and the list I'm given is never sorted (for example, vegetables are listed all over the list, and not one after the other). Also, usually I get continuously text messages with more and more items to buy, while I'm still in the super.

My approach is planning a path that would assure me I iterate the whole supermarket, and pick items from the list while walking that path.

Two ways I was thinking about:

  • foreach item in the super (n) I pass: check if I have such item in my list (m) , will give me an O(n*m) complicity, which not so efficient.
  • "dividing" the shop to rows (p) : standing on the beginning of each row I can read the sign or see which sort of items I should find there, than iterate my list, trying to remember all items in list I should find in that row. than walk that row and add those items to my cart, should give me O(p*m) complicity. but this never really happens : I can't remember more than three of four items from my list I'm expecting to find in that row, and even if I do, I often forget an item and have to use this algorithm again (lets say q times) , which comes to: O(q*p*m) .
  • A couple of comments I'd like to add:

  • when getting to the vegetable section for example, I found myself going over that section many times, cause my wife is a great cook and adds all kinds of vegetables in the list (v) . Sure I can't remember all those veggies, and rather not stop next to each vegetable in the market (or should I?), to check if I've got it in my list.
  • Crossing out each item I put in my cart (or making a new list with all items I still don't have) is very time consuming for me, so I rather just go over the whole list each time I try to find if I still have an item to add to my cart.
  • Another case is the second you get in your car before going on a family vacation. You remember you forgot to take this that and though, running back to your house, getting some of these items, forgetting others and going back again. Is this a similar case?

  • Looking up rearrangement time here, my initial idea of putting in the time to map you usual items would be useless. (they re arrange aisles pretty often).

    For any ideas going down that road - not going to work...

    链接地址: http://www.djcxy.com/p/12202.html

    上一篇: 什么是使n个项目与相应的n个项目匹配的有效方式

    下一篇: 通过购物清单访问超市,以最快的方式获取所有物品?