good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: better union of sets algorithm?by injunjoel (Priest) |
on Mar 11, 2005 at 20:14 UTC ( [id://438789]=note: print w/replies, xml ) | Need Help?? |
Greetings all, Final Update! So after my first mis-reading of the question (I computed the intersection not the union) and my subsequent code offering, I figured someone out there had to have already written this functionality, and I was right! So after a little research I would suggest List::Compare. Two week in the lab can save you two hours in the library...
of course you will need to alter $list_count depending on how many arrays you are using. Update! Perhaps I should have read the replies in more depth since I apparently didnt understand the OP question. In which case my suggestion would follow those already presented... in short:
here is the original node with benchmarks for this. Update! This got me thinking and here is what I humbly offer to the community at large.
-InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo
In Section
Seekers of Perl Wisdom
|
|