Identify-Function
Question 1 |
A set X can be represented by an array x[n] as follows:
![](https://solutionsadda.in/wp-content/uploads/2020/01/g1-9.jpg)
Consider the following algorithm in which x,y and z are Boolean arrays of size n:
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 ∪ Y) | |
(X ∩ Y) | |
(X-Y) ∩ (Y-X) | |
(X-Y) ∪ (Y-X) |
Question 1 Explanation:
X[i] ∧ ~Y[i] can be written as X - Y.
~X[i] ∧ Y[i] can be written as Y - X.
'∨' can be written as Union.
∴ (X-Y) Union (Y-X)
~X[i] ∧ Y[i] can be written as Y - X.
'∨' can be written as Union.
∴ (X-Y) Union (Y-X)