in reply to better union of sets algorithm?
I think that you might try something like this:
Whether this is faster will probably come down to data size. For really high volumes a hash approach wont work as it wont be sufficient memory efficient. (Remember a hash will normally have the same number of buckets as the next power of two larger than the number of keys in the hash.) For integers I would use BrowserUk's approach, for strings I would probably use a hash unless the data volume was really high (or i could be guaranteed the data was already in sorted form) and then i would go with something like the above.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: better union of sets algorithm?
by perrin (Chancellor) on Mar 11, 2005 at 15:09 UTC | |
by demerphq (Chancellor) on Mar 11, 2005 at 15:26 UTC | |
by perrin (Chancellor) on Mar 11, 2005 at 15:36 UTC | |
by demerphq (Chancellor) on Mar 11, 2005 at 15:40 UTC | |
by RazorbladeBidet (Friar) on Mar 11, 2005 at 15:20 UTC | |
by perrin (Chancellor) on Mar 11, 2005 at 15:32 UTC |