asked 146k views
0 votes
6

c.find the domain and range of the function that assigns to a bit string the number of ones minus the number of zeros in the string

1 Answer

5 votes
Let bitstrings have a maximum length of L bits.
and f(x)=number of one-bits less number of zero-bits.
x=length of bitstring in bits.

Case 1: x=L, all L bits are ones
Then f(x)=L
Case 2: x=L, all L bits are zeroes
Then f(x)=-L

Then
dom f(x)=[0,L]
range f(x) = [-L,L]


answered
User Geinmachi
by
8.0k points

No related questions found

Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.