Hi monks!
I have a problem with finding dublicated values in the big set of keys. So, let's imagine. I have the set of values. It's about 1 million. In real time I should check does a new value exist in my set and if not to add it.
One way is to use a hash. But it takes a lot of time when number of values is increased.
Other way is store values into a database and make unique index by values. So, when a new value is coming I can try to insert it into a table and catch exceptions.
I'd like to hear your opinions and suggestions about it.
TIA
---
Michael Stepanov aka nite_man
It's only my opinion and it doesn't have pretensions of absoluteness!
Retitled by davido from 'Finding duplicated values'.
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.