Closed rvmzes closed 5 years ago
Hi, now that you say it I think, the implementation of union should also be changed to a more optimal one, just like you have done for intersection. Also we can assume that the elements in the individual collections are unique (going by the mathematical definition of a set )
@farziengineer https://underscorejs.org/#union Computes the union of the passed-in arrays: the list of unique items, in order, that are present in one or more of the arrays.
Sorting won't do it.
Hi, you have a valid point, but going by the mathematical definition of set/union/intersection/difference we can assume the the order and the frequency of occurrence of a element in the final result does not matter. Thanks.
Please check.
Your PR cannot be merged because of conflicts. First, pull the latest changes and then, try to commit. Thanks.
Hi @farziengineer. I thought it should keep the same order like union.