Python Programs - Algorithm - Symmetric Difference

Hi There,

Has any one tried the Symmetric Difference program in python wit h following hints in python?


Hint 1

The arguments object is Array -like object that only inherits Array.length property. Hence consider converting it to an actual Array .

Hint 2

Deem writing a helper function that returns the symmetric difference of two arrays on each call instead of attempting to difference all sets simultaneously.

Hint 3

Apply helper function against the created arguments array reducing its elements pairwise recursively to form the expected output.

In the event of odd number of sets the symmetric difference will include identical elements present in all given sets. For instance;

A = {1, 2, 3}
B = {2, 3, 4}
C = {3, 4, 5}

(A ⋂ B) ⋂ C = {1, 4} &Intersection {3, 4, 5}
A ⋂ B = {1, 3, 5}

Can anyone please share your code to have a look in to it??