I have two lists A and B (List). How to determine if they are equal in the cheapest way? I can write something like ‘(A minus B) union (B minus A) = empty set’ or join them together and count amount of elements, but it is rather expensive. Is there workaround?
Share
Well, that depends on how you interpret your lists.
If you consider them as tuples (so the order of elements in lists matters), then you can go with this code:
If you consider your lists as sets (so the order of elements doesn’t matter), then… you are using the wrong data structures I guess: