Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^3: question for perl book & magazine authorsby sauoq (Abbot) |
on Oct 19, 2005 at 21:18 UTC ( [id://501434]=note: print w/replies, xml ) | Need Help?? |
Sure... if memory is so tight that you have to choose an O(n * m) time complexity over O(n + m) then I guess you gotta do what you gotta do. Of course, in that case (and especially if this is a routine task) you are almost certainly going to win by throwing more RAM at the problem because the larger your dataset the more (time) you are saving with the linear algorithm. Update: Also note that the additional memory you need will be relative to the smaller of your two arrays. (As a possible optimization depending, of course, on your data.) -sauoq "My two cents aren't worth a dime.";
In Section
Seekers of Perl Wisdom
|
|