Anonymous
Anonymous asked in Science & MathematicsMathematics · 1 month ago

Discrete Math Question. I'm not sure how to start solving this. Suggestions?

Determine if f is a function from the set of all bit strings to the set of integers: f(S) is the position of a 1 bit in the bit string S. Explain, with an example or two, why or why not.

1 Answer

Relevance
  • 1 month ago

    As defined, f(S) is a function from the set of all bit strings which have only a single 1 bit to the set of all integers. For instance,

    f(1) = 1

    f(000100) = 4

    [assuming we define the "position" of a bit by numbering the bits left to right, starting with 1].

    But it's not a function from the set of ALL bit strings, because in that case, there are strings for which f(S) can return multiple values. For instance,

    f(101) = 1

    and yet

    f(101) = 3

    also.

    • Log in to reply to the answers
Still have questions? Get answers by asking now.