Posts

So today i learnt  Sieve of Eratosthenes  the sources that i uses was anuj bhaiyas dsa course its really a interesting one  and i used geeks for geeks thats also pretty cool trick to figure out the prime  number  finding  a prime number is relly a tough when the number gets bigger and bigger SO WHATS DIFFERENT IN IT ?? in it we first take a array of length n (basically its a bollean array so it contains yes or no) intially we make it yes  then we run a loop from 2- √n   (if we focus here the loop intially is reduced so we save a lots of time ofcourse thats also true if you use ssd) so now  when we run loop for 1st the value of i(loop varible) which is 2 so we make all the multiples of 2 as false for example in the array the 4th,6th,8th10th...... positions are marked false now when the i is 3 we make all the multiples of 3 marked as false for example 6th,9th,12.... thing to note is that we mark all the multiple excepet itself that is (2nd in c...