I must say, you can get solution from anywhere but the thinking to solve a new problem can be easily built by looking at your approaches towards problems. Well explained.
This is Exactly what a Good Video would look like, no extra animated stuffs only to the point. Because once the concept is clear code part is easy. Btw i would like to add here that i think sieve should me modified for odd numbers only because all the multiples of 2 i.e. 2n are anyways not prime. So Optimized Sieve = Classic Sieve + Till Root n + Odd Numbers Only.
Right. The numbers are already marked and so will not be processed again. I think you are suggesting to jump in values of 2 rather than 1 right ? It's a good idea to not even have to check it :)
@@techdose4u Ya I mean i have read it somewhere on wiki page i think because it effects on the time/space complexity. Although there are much complex sieves which are still more optmized, and i didnt get that, but as far as this video goes. this is perfect. Thanks.
@@techdose4u Also Prime Numbers are utterly the most important concept like i have came after going through some project Eulers problem and what i had observed is that it take huge understanding of just basic maths like prime numbers to just implement an efficient algorithm. Because the Numbers on project Eulers goes upto millions for primes just to make sure you dont write an inefficient code. ;) :)
Tysm Sir the best explanation I ever had till now I immediately subscribed to your channel because I know this will be very very useful for me .. Once again thank you Sir.
The outer for loop is making sqrt(n) iterations. So, why the complexity isn't sqrt(n)LogLogn instead? Correct me if I am wrong. And Thanks for such a good explanation :)
Python code incoming.. from math import sqrt def sieve(n): if n < 2: return [] ar = [True for i in range(n+1)] p = [] for i in range(2, int(sqrt(n))+1): if ar[i] is False: continue for j in range(i**2, n+1, i): ar[j] = False p=[i for i in range(n) if i>=2 and ar[i]] return p n = 19 print(sieve(n))
Nice video, although I came to see geeksforgeeks version of optimized version sieve of eratosthenes, I got a hint from this video about gfg's solution. A like for that also..
This is the only channel that has explained the concept that why to start the inner loop from i^2 & why to stop the outer loop at sqrt(n). 🤩🤩
🔥
bhai mene gfg ki video dekhi..dimaag crash kr gya tha
You could write "i * i
The compiler would optimise that by itself
I must say, you can get solution from anywhere but the thinking to solve a new problem can be easily built by looking at your approaches towards problems. Well explained.
Thanks
This is a very underrated channel this is a very under rated channel
One thing is clear that u are a Genius...🔥👍🏽
The explanation is literally Supercalifragilisticexpialidocious 🔥🔥🔥
What's this word bro 😅
The exact video I was looking for. Thanks for the great video.
Buddy u r awesome, u build very deep understanding and intuition of logic. Thanks for such explanations.
Welcome 😀
This is Exactly what a Good Video would look like, no extra animated stuffs only to the point. Because once the concept is clear code part is easy. Btw i would like to add here that i think sieve should me modified for odd numbers only because all the multiples of 2 i.e. 2n are anyways not prime. So Optimized Sieve = Classic Sieve + Till Root n + Odd Numbers Only.
Right. The numbers are already marked and so will not be processed again. I think you are suggesting to jump in values of 2 rather than 1 right ? It's a good idea to not even have to check it :)
@@techdose4u Ya I mean i have read it somewhere on wiki page i think because it effects on the time/space complexity. Although there are much complex sieves which are still more optmized, and i didnt get that, but as far as this video goes. this is perfect. Thanks.
@@techdose4u Also Prime Numbers are utterly the most important concept like i have came after going through some project Eulers problem and what i had observed is that it take huge understanding of just basic maths like prime numbers to just implement an efficient algorithm. Because the Numbers on project Eulers goes upto millions for primes just to make sure you dont write an inefficient code. ;) :)
I will cover that when I start Number theory playlist :) Concepts of primes and complex sieves.
Awesome explanation for the optimization ;)
Thanks
Thank you so much, it helped on my C++ course
what will be the time complexity of FIRST METHOD of sieve of eratosthenes ??????
Great respect for you & your explanation of algorithms.🙏
sir i could not understand why we need to take upto sqrt(N) in first loop
Tysm Sir the best explanation I ever had till now I immediately subscribed to your channel because I know this will be very very useful for me ..
Once again thank you Sir.
Welcome :)
That was a super explanation:)
Thanks :)
At 3:52 why take j
Thanks for this video but can you tell how to do this in O(n) Time complexity
great job sir, well explained, easy, understandable.
Excellent explanation sir
ek no guruji
The outer for loop is making sqrt(n) iterations. So, why the complexity isn't sqrt(n)LogLogn instead?
Correct me if I am wrong.
And Thanks for such a good explanation :)
I think that is because each identified number goes and marks all other multiples, thus iterating till end.
hey Techdose, what's the name of the software that you are using to explain your code?
beautifully explained
Thanks
Happy to see tricolors in the beginning .💜
😅
Thanks for this video, you're explanation is amazing 😃
Welcome :)
that TC explanation by gfg is so complex, they haven't explained properly..
can you please make a video explaining that ?
Very nicely explained ❤️
Thanks 😊
Very nice problem. Thanks!
it is not applicable for 10^12
very nice explanation:)
Awesome please do more videos on these type of questions
Thanks :)
where is segmented sieve with O(n) complexity?
explained beautifully...
Thanks :)
Well explained
how to prove that the factor
TYSM SIR!
Respect ++ !
Python code incoming..
from math import sqrt
def sieve(n):
if n < 2:
return []
ar = [True for i in range(n+1)]
p = []
for i in range(2, int(sqrt(n))+1):
if ar[i] is False:
continue
for j in range(i**2, n+1, i):
ar[j] = False
p=[i for i in range(n) if i>=2 and ar[i]]
return p
n = 19
print(sieve(n))
👍
plz make playlist on dynamic,tree,graph
Doing so
Thanks
Welcome :)
Sir, i have a doubt and i have put that doubt on candy distribution problem video . Sir i am waiting for the reply .......
Okay let me check.
J=j+i; how it increment
You are the best 💝💌
Thanks :)
here I know only why to start inner loop from i^2 & outer loop upto SQRT N
thanks for this video its helpful
Welcome :)
Great explanation!
your color scheme was already aligned for "Independence day : azadi ka amrit mahotsav" 😂😂 kool video though
god bless you
:)
Nice video, although I came to see geeksforgeeks version of optimized version sieve of eratosthenes, I got a hint from this video about gfg's solution. A like for that also..
Nice
Awesome❤️
:)
what if, N=40 and 35 is not divisible by 2 & 3.
Then you will mark mutiples of next prime number which is 5.
Please Make a video on sieve of atkins.
Yea sure
amazing exlpanations
Thanks :)
can you make video of solution of leetcode
I will do it whenever I get time.
good way.....thanks
Welcome :)
Thank you
Welcome
SEIVE MAANE CHHANII HOGAA😂😂😂
😂
No ,, your logic is wrong. We can continue the loop till Square Root of number
First viewer
:)
BASIC NUMBER THEORY....PADHO....
Thank You
Welcome :)