Symmetric difference of two arrays

I have two NSArrayMovie objects called DVD and VHS. I would like to find the symmetric difference of these arrays. I want to know which films on VHS are not bought on DVD, but which films are on DVD, but not on VHS.

Can someone tell me if there is a quick algorithm to solve it (preferably in C or Objective-C)? Is it faster / easier to decide if I use dictionaries? What is called this problem (or is it just a "symmetrical difference")?

Thank.

+3
source share
3 answers

, NSSet, NSArray, , .

NSSet intersectsSet:, , .

, NSMutableSet.

+2

VHS DVD DVD VHS , -removeObjectsInArray:.

, ObjC.

+1

Title of the Movie (MergeSort), , .

0

Source: https://habr.com/ru/post/1733337/


All Articles