Algorithms | Misc | Question 13

Last Updated :
Discuss
Comments

A set X can be represented by an array x[n] as follows: 

 


Consider the following algorithm in which x,y, and z are Boolean arrays of size n: 

C
algorithm zzz(x[] , y[], z [])
{
   int i;
   for (i=O; i<n; ++i)
     z[i] = (x[i] ^ ~y[i]) V (~x[i] ^ y[i]) }

The set Z computed by the algorithm is:

(X Intersection Y)

(X Union Y)

(X-Y) Intersection (Y-X)

(X-Y) Union (Y-X)

Share your thoughts in the comments