Help understanding the solution to this problem

44 Views Asked by At

Here is the problem:

There are sixteen different ways of writing four-digit strings using 1s and Os. Three of these strings are 1010, 0100 and 1001. These three can be found as substrings of 101001. There is a string of nineteen 1s and Os which contains all sixteen strings of length 4 exactly once. If this string starts with 1111, the last four digits are (A) 1110 (B) 0000 (C) 0110 (D) 1010 (E) 0111

Here is the solution:

If the fifth symbol was 1 then 1111 would occur twice, so the initial substring is 11110. If the string 0111 (alternative (E)) was not at the end then there would be an 01111 or an 01110 substring. Both of these are impossible as 1111 and 1110 have already occurred. So the length 19 string must finish with 0111, hence (E).

In the solution I do not understand why there would be 01111 or 01110 if answer E was not at the end as it states in the solution here "If the string 0111 (alternative (E)) was not at the end then there would be an 01111 or an 01110 substring.". Please help clarify this for me.

1

There are 1 best solutions below

0
On

"If the string 0111 (alternative (E)) was not at the end then there would be an 01111 or an 01110 substring."

Observe that the two sub-strings are the two possible 5-digit binary strings that begin with 0111. That 4-digit binary string 0111 is what has been given the name or label "alternative E."

This is very simple: if alternative E isn't at the end of the particular 19-digit string that begins with 1111, then alternative E occurs strictly before the end, meaning that we will see at least one digit after alternative E if we look inside the 19-digit string that we are considering. After all, our particular string of 19 bits contains all 4-digit bit sequences, so in particular it contains alternative E.