Google News
logo
Algorithm - Quiz(MCQ)
What is the time complexity of the Sieve of Eratosthenes to check if a number is prime?
A)
O(nlog(logn)) Precomputation, O(1) for check.
B)
O(n) Precomputation, O(1) for the check.
C)
O(n) Precomputation, O(logn) for check.
D)
O(n * logn) Precomputation, O(logn) for check.

Correct Answer : Option (A) :   O(nlog(logn)) Precomputation, O(1) for check.

Advertisement