Share Link
Copied to clipboard
Embed on Your Page
Copied to clipboard
We Stand with Ukraine
[forkv4]Get difference between two unorderd, not unique lists, duplicates allowed within a list and across both lists by foxandfiddle
RANDOM CASE -two unorderd, not unique lists 
A  = a,7,1,2,3,4,5,9,7,7,1,222222222222222222,22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222323
B  = a,1,1,2,2,3,4,5,5,5,5,999999999999999999,22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222323
A count = 13
B count = 13
(A-B) Result = 7,9,7,7,222222222222222222
(B-A) Result = 2,5,5,5,999999999999999999
No. of loops = 115
No. of loops = 26 - Post copy using BitArray to a sized array
Result Unorderd Final A then B = 7,9,7,7,222222222222222222,2,5,5,5,999999999999999999 in 72 ticks.
Result Unorderd Final B then A = 2,5,5,5,999999999999999999,7,9,7,7,222222222222222222 in 72 ticks.
Note: In a VS solution this is 47 ticks.
Result  Ordered Final = 2,222222222222222222,5,5,5,7,7,7,9,999999999999999999
Result  O(n^2+2n) but very fast - can you beat it?


ExceptIndistinct - Reddit Solution by UninformedPleb

No. of loops = 46
Result Unorderd Final A then B = a,7,9,7,7,222222222222222222,22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222323,2,5,5,5 
in 20081 ticks.


ExceptIndistinct - Reddit Solution by UninformedPleb using arrays

No. of loops = 50
Result Unorderd Final A then B = a,7,9,7,7,222222222222222222,22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222323,2,5,5,5 
in 1798 ticks.


StackOverflow ExceptFrom

No. of loops = 0
Result Unorderd Final A then B = a,7,9,7,7,222222222222222222,22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222323,2,5,5,5 
in 18996 ticks.
Cached Result
Last Run: 6:28:44 pm
Compile: 0.126s
Execute: 0.016s
Memory: 32kb
CPU: 0s