Chapter 2: Q57E (page 137)
Show how bitwise operations on bit strings can be used to find these combinations of\(A = \{ a,b,c,d,e\},\)\(B = \{ b,c,d,g,p,t,v\},\)\(C = \{ c,e,i,o,u,x,y,z\} ,\) and \(D = \{ d,e,h,i,n,o,t,u,x,y\} \)
a) \(A \cup B\)
b) \(A \cap B\)
c) \((A \cup D) \cap (B \cup C)\)
d) \(A \cup B \cup C \cup D\)
Short Answer
Given:
\(A = \{ a,b,c,d,e\} ,\)
\(B = \{ b,c,d,g,p,t,v\} ,\)
\(C = \{ c,e,i,o,u,x,y,z\} ,\)
\(D = \{ d,e,h,i,n,o,t,u,x,y\} \)
If the \(ith\) bit in the string is a \(1\), then the \(ith\) letter of the alphabet is in the set.
If the \(ith\) bit in the string is a \(0\), then the \(ith\) letter of the alphabet is Not in the set.
The alphabet contains \(26\) letters; thus, each string needs to contain \(26\) bits.
\(A:11111\)\(00000\)\(00000\)\(00000\)\(00000\)\(0\)
\(B:01110\)\(01000\)\(00000\)\(10001\)\(01000\)\(0\)
\(C:00101\)\(00010\)\(00001\)\(00000\)\(10111\)\(0\)
\(D:00011\) \(00110\) \(00011\) \(00001\) \(10011\) \(0\)