Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I myself have pondered this. Consider the following:</p> <blockquote> <p>If it takes you a week to figure out, code, and debug and algorithm that only provides a 1% discount, would you do it?</p> </blockquote> <p>The answer is probably "No" (unless you're spending your entire life savings on cards, in which case you may be crazy). =)... or Amazon.com</p> <p>Consequently, there is already an easy approximating algorithm:</p> <pre><code>Wait until you're buying lots of cards (reduce the shipping overhead). Buy the cards from 3 vendors: - the two with the cheapest-but-most-diverse inventories - a third which isn't really cheap but definitely has every card you'd want. Optimize accordingly (for each card, buy from the cheaper one). Also consider local vendors you could just walk to, pre-constructed decks, and trading. </code></pre> <p>Based on firsthand and second experience, I can say you will find that you can get the median price with perhaps a few dollars more shipping you could otherwise, while still getting around median on each. You will find that you may have to pay a tiny bit more for understocked cards, but this will be few and far between, and the shipping savings will make up for it.</p> <p>I recall the old programming adage: <strong>"Never optimize, until it's absolutely necessary; chances are you won't need to, or would have optimized the wrong thing."</strong> (e.g. your time is a resource too, and also has monetary value)</p> <p>edit: Given that, this is an amazingly cool problem and one should solve it if one has time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COI strongly disagree. There's optimization and optimization. If you optimize your code in the sense of "let's make this loop run faster" I agree. Here, you're dealing with a question of computational complexity, which means you're not talking about %, but whether code that runs in 1 second for n cards will run 2 seconds or 10 seconds for 2n cards (or will blow up your system if by some freak chance you happen to look up 10n cards)
      singulars
    2. COI actually disagree with the conjecture that it isn't worth solving the problem because it might not justify itself from an actual savings point of view. I solve a lot of problems just because they seem like interesting problems to solve. I consider it the programmer's curse - the desire to write a program to solve all the problems they encounter. Although Thomas Edison agrees with you since he would only pursue an invention he thought people would buy.
      singulars
    3. CONicolas78: No, the poster explicitly asks how he should trade off computational complexity for a reasonable estimate. "If you were going to tackle this how would you do it? Pure brute force figuring every...? ...to be done in my lifetime would seem to involve a methodical series of estimates over a fixed number of iterations. I have a couple ideas, but am curious what others might suggest." As you can see, this this answer is acceptable. An approximating answer is an answer. Also this approximation obviously runs in `O(n)` time, so no optimization is needed as you imply.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload