The Function fbinary strings binary strings In each case fi
The Function f:{binary strings} --> {binary strings}. In each case, find f(s).
a) s = {000, 1011, 10001}, f(x) = the second bit in x
b) s = {111, 100, 0111}, f(x) = the binary string that is the sum of the first and last bit
c) s = {001, 11, 101}, f(x) = the binary string that is equal to x + 1
Solution
Given The Function f:{binary strings} --> {binary strings}.
a) s = {000, 1011, 10001}, f(x) = the second bit in x.
f(s) should have strings such as the second bit of strings of s.
Therefore, f(s) = {0, 0, 0}
b) s = {111, 100, 0111}, f(x) = the binary string that is the sum of the first and last bit
f(s) should have strings such as the sum of the first and last bit of s.
111: sum of first bit and last bit =1+1 =10 (carry 1 and sum 0)
100: sum of first bit and last bit =1+0 =1
0111: sum of first bit and last bit =0+1 =1
Therefore, f(s) = {10, 1, 1}
c) s = {001, 11, 101}, f(x) = the binary string that is equal to x + 1
f(s) should have strings such as the binary string that is equal to x + 1
001+1 = 010
11+1 = 100
101+1 = 110
Therefore, f(s) = {010, 100, 110}
