Determine whether f is a function from the set of all bit strings to the set of
integers if
a) f (S) is the position of a 0 bit in S.
b) f (S) is the number of 1 bits in S.
c) f (S) is the smallest integer i such that the ith bit of
S is 1 and f (S) = 0 when
Answers
Answered by
0
Answer:
f(S) is the number of 1 bits in S
Answered by
1
For option (a), f is not a function because:
- There are two conditions for f to be a function, first one is that f(a) is always lies in the domain a and the second condition says that, f(a) is only one unique element for example if f(a) = c and f(a) = c' the c = c' as f(a) has a unique element.
- But the first option does not satisfy both the condition as the string has no perfect value.
For option (b), f is a function because:
- There is a provided unique value for the string 1, which satisfies the first condition and we cannot have two different integers for the same string(we cannot have 1 and 2 to be considered in string 1) so it satisfies the second condition too.
For option (c), f is a function because:
- Here f has a string that has a unique value, i.e S = 1 by which f(S) = 0 will also have some value in terms of integer and satisfies the conditions, unlike the first option.
Similar questions