Well, I think that you can do some short-circuiting. Assume we have five items and that, at some point in your process, you have found that the maximum distance is at least 4 (e.g. you've found at least one pair of students that have only one item in common,). Then, when you are comparing some other student pair, if you find two items in common, you can stop checking the other items, you know that you're not going to find a better distance (well, in fact, you can do that even earlier: as soon as you have found one common item, you're not gonna find a larger distance). In other words, you would still have to go through every possible pair, but you can often cut down the number of items that you will need to compare. Not sure this helps much, though, it depends on how you implemented your algorithm. And maybe you already figured that out and I am just stating the obvious (please forgive me if such is the case), but I still wanted to say it just in case it might help.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.