BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
Given 2 arrays of numbers, I want an efficient algorithm for "cancelling out". (There is probably a proper name for this, but I don't know it).
Most easily described by example. Given:
I want to cancel values between the arrays to end up with:
Note. This is a trivial example. Both the sizes of the arrays and the values will be much larger.
Update: This is not the elimination of duplicates or intersection of arrays. Once any duplicates have been eliminated, it then becomes a task of reducing factors from @a & @b unil no further factors can be removed.
2005-08-16 Retitled by Arunbear, as per Monastery guidelines
Original title: 'Algorithm wanted'