Question: Using C language , write a simple program to exhaustively list (generate) all binary strings of length N . Your program should read N >
Using C language, write a simple program to exhaustively list (generate) all binary strings of length N. Your program should read N > 5 as input and then list all binary strings of length N. Use your program to answer the following questions by testing each of your generated binary strings. (a) How many binary strings of length N contain the substring 1010 (1011110 has a substring of 1010)? (b) How many binary strings of length N contain at least four 0s? (c) How many 5-element subsets of {1,2,3,...,N} contain both 1 and 2?
Provide the answers to the above questions for N=9 and N=10.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
