diff --git a/Sieve of Eratosthenes in 0(n) time complexity b/Sieve of Eratosthenes in 0(n) time complexity new file mode 100644 index 0000000000000..1f6c45a2a0121 --- /dev/null +++ b/Sieve of Eratosthenes in 0(n) time complexity @@ -0,0 +1,74 @@ +import java.util.Vector; + +class Test +{ + static final int MAX_SIZE = 1000001; + // isPrime[] : isPrime[i] is true if number is prime + // prime[] : stores all prime number less than N + // SPF[] that store smallest prime factor of number + // [for Exp : smallest prime factor of '8' and '16' + // is '2' so we put SPF[8] = 2 , SPF[16] = 2 ] + static Vectorisprime = new Vector<>(MAX_SIZE); + static Vectorprime = new Vector<>(); + static VectorSPF = new Vector<>(MAX_SIZE); + + // method generate all prime number less then N in O(n) + static void manipulated_seive(int N) + { + // 0 and 1 are not prime + isprime.set(0, false); + isprime.set(1, false); + + // Fill rest of the entries + for (int i=2; i (@knickers) -0.30.43: git://github.com/mongo-express/mongo-express-docker@3290958fd1ff8218baad0ed85cf3e66123baab84 -0.30: git://github.com/mongo-express/mongo-express-docker@3290958fd1ff8218baad0ed85cf3e66123baab84 -latest: git://github.com/mongo-express/mongo-express-docker@3290958fd1ff8218baad0ed85cf3e66123baab84 +0.30.47: git://github.com/mongo-express/mongo-express-docker@d1bc77a1802818a7c5141bc6a52c2f42170fdf62 +0.30: git://github.com/mongo-express/mongo-express-docker@d1bc77a1802818a7c5141bc6a52c2f42170fdf62 +latest: git://github.com/mongo-express/mongo-express-docker@d1bc77a1802818a7c5141bc6a52c2f42170fdf62