Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please answer question 3 b) 2. Prove that 1m+2ml (n+1 and use this to find a for

ID: 3607415 • Letter: P

Question

please answer question 3 b)

2. Prove that 1m+2ml (n+1 and use this to find a formula for 12+22+3++ 3. Find generating series for the number of (a) binary strings of length n that do not contain the substring 1100 (b) binary strings of length n that to not contain the substring 1011 (c) words of length n on the alphabet ta, b, el such that b is never adjacent to c (d) compositions of n in which no two consecutive parts are equal to 1 4. (Bonus) Let tn be the number of tilings of a 2 x n rectangle using 2 x 1 and 1 x 1 tiles a closed form for the generating series T(z)- nso tna" and use it to give a recurre tn), along with initial conditions.

Explanation / Answer

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>

void main()
{
   char s[100]; char s1[4]="1011"; int i=0,j=0,k=0,x=0,p=0,c=0,n=0,num=0;
   clrscr();
   randomize();
   cout<<" enter no of strings to generate";
   cin>>num;
   cout<<" enter string length";
   cin>>n;
  for(k=1;k<=num;k++)
  {
  //following loop will generate binary strings
  for(i=0;i<n;i++)
   {
   x=random(2);
   if(x==0)s[i]='0';
   else s[i]='1';
   }//for
   s[i]='';


   for(i=0;i<strlen(s);i++)
   {

   p=0,c=0;
   //foll loop is checking if any four consecutive chars are 1011
   for(int m=1,j=i;m<=4;m++,j++)
   {
   if(s[j]==s1[p])
   {
   c++;p++;
   }
   }//if

   // when 4 consecutive chars are 1011 the this string is not printed and next string is examined
   if(c==4)
   { k--;
   break;
   }

   }
   if(c!=4)
   cout<<" "<<s;
}
  getch();

}