Re: [algogeeks] Compiler doubt

2013-04-03 Thread Nainy Agrawal
follow(A)={a,b} follow(B)=follow(S)=follow(A)={a,b} follow(A) is pretty straight forward follow(B) is this because since it can be seen that it is equal to follow(S), as follow B in the grammar does not have anything so hence it is equal to the production that resulted it and hence follow(S) and s

[algogeeks] Re: Sieve

2012-12-21 Thread Nainy Agrawal
Can someone explain how this code works ... void sieve(int n) { int x=n/2, y=(int)sqrt(n); arr[1]=2; for(int i=1;i<=x;i++) prime[i]=false; for (int i=1; i<=y; i++) { if (!prime[i]) { for (int j=3*i+1;j<=x;j+=(2*i+1)