Skip to main content
19 events
when toggle format what by license comment
Jun 26, 2018 at 22:06 review Suggested edits
Jun 27, 2018 at 6:00
Aug 22, 2011 at 18:54 comment added GAgnew I should note before you try to tell me that 'l = a.length; i < l' is faster because it only does 'one calculation'; that this is not the case. Unlike some other languages, in javascript '.length' is a property on all arrays, not a calculation.
Aug 22, 2011 at 18:47 comment added GAgnew @meder First of all, why do you make an array of 'non-duplicates' and then concat them to the original array? why not just push the 'non-duplicates' to the original array to begin with. Secondly, why the **** do you have 'l = a.length; i < l' ?? it should be 'i < a.length'. Your causing ridiculous extra lines of execution, to the point where it is just pure wrong.
Aug 19, 2011 at 13:33 comment added GAgnew This is a good answer, although I am prompted to down-vote simply from the poor code that is shown here. That array.prototype.uniqueMerge function is horrendous, I haven't looked at the rest.
Oct 18, 2009 at 15:12 comment added Amarghosh It's unfair, this should definitely come on top of the jQuery one, at least.
Oct 18, 2009 at 13:51 comment added meder omuraliev Can any of you downvoters actually explain why you downvoted? My original solution solved the OP's issue, and my updated code does the same. The selected answer did not initially account for the ordering to which it was fixed later.
Oct 18, 2009 at 11:10 history edited meder omuraliev CC BY-SA 2.5
added 26 characters in body; added 1 characters in body; added 29 characters in body
Oct 18, 2009 at 11:03 history edited meder omuraliev CC BY-SA 2.5
added 475 characters in body; added 4 characters in body; deleted 599 characters in body; deleted 23 characters in body
Oct 18, 2009 at 11:00 comment added LiraNuna @Amarghosh: My solution wasn't posted after the OP's comment about order.
Oct 18, 2009 at 10:18 comment added Amarghosh did you find out what does >>> 0 do in there? I can't think of an example where >>> 0 would make any difference.
Oct 18, 2009 at 9:40 history edited meder omuraliev CC BY-SA 2.5
added 234 characters in body; deleted 2 characters in body
Oct 18, 2009 at 9:31 comment added Amarghosh @LiraNuna your solution doesn't seem to preserve the order. [a,b,c] and [x,b,d] would give [a,c,x,b,d] instead of [a,b,c,x,d].
Oct 18, 2009 at 9:19 comment added Gumbo @meder: My algorithm is a union algorithm. The union itself is done in O(n+m), but sorting takes at most O(n·log n+m·log m). So the whole algorithm is O(n·log n+m·log m).
Oct 18, 2009 at 8:58 comment added meder omuraliev What algorithm is your answer?
Oct 18, 2009 at 8:55 comment added Gumbo Note that this algorithm is O(n^2).
Oct 18, 2009 at 8:50 comment added meder omuraliev It's not a standard ECMAScript method defined for Array.prototype, though I'm aware you can easily define it for IE and other browsers which don't support it.
Oct 18, 2009 at 8:47 vote accept Vijjendra
Oct 18, 2009 at 13:26
Oct 18, 2009 at 8:46 comment added Vijjendra @Mender: if order is not matter then how I do this
Oct 18, 2009 at 8:42 history answered meder omuraliev CC BY-SA 2.5