Q 8: Count the number of 01-strings with following constraints.
(b) The length is 8. Number of 1s is 3 more than number of 0s.
(c) The length is 9. Number of 1s is 3 more than number of 0s.
Assuming question asks
(b) The length is 8. Number of 1s is at lease 3 more than number of 0s.
(c) The length is 9. Number of 1s is at lease 3 more than number of 0s.
For length n, let
n0=number of zero bits
n1=number of one bits
and
n0+n1=n
(b)
For case n=8
situations where n1-n0≥3 are
{(8,0),(7,1),(6,2)}
with corresponding number of occurrences
{C(8,0),C(8,1),C(8,2)}={1,8,28}
[where C(n,r)=n!/(r!(n-r)!)]
so the total number is 37.
You can work out (c) in a similar way. Post if you wish, to check your answer.
For deep learning, suggest you to attempt to generalize the question to n-bit string, where n1-n0≥d
* least
To count the number of 01-strings with the given constraints, we need to consider each constraint separately.
(b) For a length of 8, where the number of 1s is 3 more than the number of 0s:
Step 1: Determine the number of 0s.
Since the number of 1s is 3 more than the number of 0s, we can start by assuming the number of 0s.
Let's try with 2 0s.
Step 2: Determine the number of 1s.
Since the number of 1s is 3 more than the number of 0s, we can add 3 to the number of 0s.
In this case, the number of 1s would be 5.
Step 3: Generate the string.
We can now generate the 01-string using the determined number of 0s and 1s.
For example, one possible 01-string in this case would be 00111011.
Step 4: Repeat steps 1-3 for other possible combinations of 0s and 1s.
In this case, we can try assuming 3 0s and determine the number of 1s accordingly.
Step 5: Count the total number of combinations.
Count the total number of valid 01-strings generated using all possible combinations of 0s and 1s. Add up the counts from each step.
(c) For a length of 9, where the number of 1s is 3 more than the number of 0s:
Repeat steps 1-5 from the previous example using a length of 9 instead of 8.
By following these steps, you should be able to count the number of 01-strings with the given constraints for each scenario.