Prove that the time complexity for the following code is nloglogn.
void sieveOfEratosthenes(int n){ boolean prime[] = new boolean[n+1]; for(int i=0;i<> prime[i] = true; for(int p = 2; p<=sqrt(n);>=sqrt(n);> // If prime[p] is not changed, then it is a prime//
if(prime[p] == true){ // Update all multiples of p for(int i = p*p; i <= n;="" i="" +="">=> prime[i] = false;
} } // Print all prime numbers for(int i = 2; i <= n;="">=> if(prime[i] == true) System.out.print(i + " ");
}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here