how does the complexity of this code would be 0(N LOG LOG N)
?
for(int j=3;j<=100;j=j+2){
if(p[i]===1){
for(int j=j*j;j<=100;j=j+2){
p[j]=0;
}
}
}
how does the complexity of this code would be 0(N LOG LOG N)
?
for(int j=3;j<=100;j=j+2){
if(p[i]===1){
for(int j=j*j;j<=100;j=j+2){
p[j]=0;
}
}
}
hello @manish99
it time complexity is just summation of
n/2 + n/3+ n/5 + n/7 + n/11 …
take n common
n( 1/2 + 1/3 + 1/5 + 1/7 + 1/11 + 1/13…1/p )
1/2 + 1/3 + 1/5 + 1/7 … 1/p= log(logn)
for proof refer this -> link
=n * log (log n )
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
I am not able to understand it
to undersand the prooof u must know about harmonic series,euler product forumula and tyler series.
also i have already shared prrof link with u , do check that out