Maths for DSA/CP : All You Need To Know
Vložit
- čas přidán 16. 07. 2024
- In this video, I tried to cover all of the things that are math related and are used in Competitive Programming till the Beginner and Intermediate Level.
Maths in this video is enough for getting till the purple (candidate master) level.
If you want to advance higher, you'll have to learn more things - like Probability and Expected Values, more Number Theory etc.
Subscribe for more content.
Chapters:
00:00 - Introduction and Expectations
01:50 - Part 1
Number theory basics, Divisors, Multiples, Sieve, GCD, etc
30:40 - Part 2
Modulo Arithmetic, Binary Exponentiation, Division Under Mod
59:00 - Part 3
Basic Combinatorics, Counting Principles, How to find nCr%p
Don't stop the DSA/CP series! Amazing video as usual!!
Best Video on number theory by Best of the Community
Exactly this is what I m searching for for.
GREAT EXPLANATION
Awesome video!
This is very high quality content, Eagerly waiting for the second part.
I really respect the people who add time stamps in their videos
Your explanations are great. Well done!
Crisp and to the point content. Well Done.
Wow! Modulo inverse and Fermat theorem Explanation I will never forget, ❤❤❤❤.
This is the thing I was waiting from past 4 years
thanks for explaining modulo arithmetic in full details !!! great work
Gread content Grandmaster. Keep uploading. 🤝
Not all heroes wear capes.. Some make DSA videos on YT.
Thanks brother 🙌
Amazing content, as usual!
Just the content I was looking for !
Thank you for the video
Oh finally you are back 😊 :))) much more love to you bhaiya
Thank you Bhaiya...
Modular Arithmetic part taught me something new.. 😊
Literally bhaiya I was finding this type of video for 2-3 days and nothing got quality content like this
Thanks a lot
Aapne meri sun li
I am in mid of CP course of coding ninja and I recently going with topic of number theory and almost mujhay meri kashti dubti nazar aarahi this but is video ne meri kasti sambhal li modulo arithmetic part is awesome for me thank you Utkarsh bhaiya.
CP course is paid or free?
At 45:50, if b==0, you should return 1; this code gives the wrong answer in some test cases. ex= 9 1 7
Thank you.
Waiting for the next video.
You are inspiration for me ❤️✨
Thanks for this. It really helps me a lot .
Bro please make a video on dynamic programming
I think ,he already have some videos on dynamic programming :)
Watch striver's channel
Practice
Today i start cp and learning from grandmaster directly.. like wow this is amazing! Lot of resp++
In 24:03, while explaining sieve of eratosthenes, the upper for loop should go from 2 to i * i
The time complexity is still the same...
Plus my template also stores all of the primes in a vector, so that's why i < N
Got it brother! Thanks for your instant reply!
@@utkarshgupta9858 sun yr, bit manipulation pe bhi sikha de kuxh...
So you mean constant not matter I*i we get const value and for big o for worst case we can't consider constant so it's complexity O(n) times
@@utkarshgupta9858 can u share related problems of these topics
SIR UR DOING GREAT JOB FOR US ...THANKU PLEASE MAKE MORE THIS VIDEOS .WE GET TO LEARN MANY THINGS FROM IT
Hola, Utkarsh Gupta!
Please keep it up this kind of competitive edu series. Thanks!
after so long
wating for this video
Most awaited video♥️♥️
Nice, bro long time no see. I was waiting.....
please make more videos please increase the frequency as this is kind of content we want!
He is INDIA RANK 2 Bro
@@shri9229 now 1 🤦♀️
the nlogn proof was amazing
just the person I was looking for, thanks 🙌
Person or video? 😛
@@utkarshgupta9858 Ig the "person" who can make many such "videos".
How come we feel the same ❤️❤️ the one I was looking for
thanks, ❤ bhaiya I wanted this type of video.
From where you learn all these things or just while practicing you learn..
Cpalgorithms
pre rmo
How to setup sublime like that in 5:30 , the TC part ?
This is perfect lecture
By the way, time complexity of gcd is log(min(a,b)).
very nice explanation, just adding the practice questions related to the concepts would be even better.
Thank you sooo much!!!
Awesome class!
thank you very much! very helpfull!
Please make one whole video explaining time-complexity also.
hey in your binary exponentiation (pw) function, in the base case if b is 0 then we should return 1 as a^b will become 1 and m is assumed to be greater than 1.
Yes you're right... I made a typo in the code.
Modular division at 55:35 for these two cases are not returning equal output,
a=48521 b=654 m=17
output : 6 11
a=48521 b=654 m=13
output : 9 11
Is it only happening with me? or they do produce different output?
Really liked your explanations and proofs for n/1, n/2 , n/3, ....n/n = logn
Intuition why sieve inner loop starts at i*i and the way you improved the complexity o(n), o(sqrt(n)), for queries o(n*loglogn)
Intuition of mod operations ( +, -, *, /) and why / wont work like other.
o(1) calculation of inverse m! ( it looked obvious after you explained XD ) m/m! -> 1/(m-1)!
Great Lecture Bro!
this helps a ton !!
At 23:55 that sieve template, how the whole template code arrives just by typing sieve?
Hi Utkarsh how are you getting all that , test , run ,edit , time and stop feature in your editors output
Amazing Video.
You're awesome 🙌
how did you change your codeforces cp handle from healthyUG to demoralizer??? i just wrote without thinking much at that time now i want to change it! how to do it can you tell me plz!
simply awesome
in the mod program, if b==0 we should return 1 or a%m?
Hwy, plz make video on time complexity. Thk yu for helping us
Is it possible to right a number in form of 3^x + 7^y where x and y is any positive integer value.
We need to return true or false.
Can someone please provide a efficient solution for this question?
Hey recently saw your mock interview with kerthi purswani in which you mentioned that hard ques will most probably be not asked in google interviews. Can you make a detailed video about the difficulty level of ques that can be asked in google interviews with examples of some questions so we can get a good idea about the level of ques asked. Also if you could compare them with respect to leetcode medium and hard questions that would be very helpful. Thanks in advance!
Are JOD sir 🤩
Please make a video for greedy it is very helpful
How did you setup sublime for CP
Can you tell pls.
Thank you LORD DEMORALIZER
can you please give practice problems on Maths part in DSA
Grt video. Please share some problem set to practice
Which software did you use for drawing??
kindly continue with Graph series
After so long.... finally..😌
Please make a video on bit manipulation. Especially on XOR operation
yes , please !
everything about bitwise operator questions in CP
Hello brother ! Please make a video on how to setup Sublime text as you had in your laptop
Bro please tell how to make sublime like yours
Bhaiya can you please attach some practice problems and relevant further reading material on this?
Thanks
Hey brother can u make a video on how to setup sublime text like you for competitive programming
in pw(a, b, m), when b is 0, why are you returning a % m? it should always be 1 right?
Oh right yeah... I think I mistyped that part... And the tests didn't fail🤦🏻♂️
I hope learners don't get confused. Thanks for pointing out
Nice explanation
if you prefer a textbook, consider the competitive programmers handbook :)
I used to dread Modular multiplicative inverse. Not anymore 😌
thank you legenD !!!!!
for prime approach would this be not much faster ?
bool isPrime(int N) {
if(N==1){
return false;
}
int count = 0;
for(int i = 1; i*i
removing the nested if won't reduce the time complexity it will still be O(root(n))
27:50
time complexity should be O(log(min(a,b)))
correct me if I am wrong
Bhaiya plS make video on how to Start for CP.. How should we learn Dsa correcr way
Thanks!!
Thanks 👍
Bro please make a video on your sublime text setup of U .
Can someone please tell me which software he used to create thie presentation please
I have one doubt if we multiply a number it gets overflow and if we add also it gets overflow but if we divide a number how it will get overflow
thanks for video bro
Sir please make video on dp and graphs from basic to advanced
can u explain what is O(log)
Bro before cp what are the topics we want to cover in dsa
42:21 shouldn't base case return 1
sir can you please tell me from where you learned all this topics??
Searching and sorting and precomputation
Hey, could you please make a video on how to setup sublime text for cp on windows. It's really frustating for windows peeps to execute and run programs.
Checkout Luv competitive programing course playlist.The second video completely about setup Link: czcams.com/video/Zlx7gmt3lBU/video.html
@@humanbeing6042 I have already seen it. But not able to setup from his way. I am not able to make my custom build file and stuck forever :(
You can use WSL to get the linux experience on windows
bhaiya please make a video on dynamic programming
Please share your sublime setup
🔥🔥
Purple is my aim for this year.
Could you please add captions (English Subtitle) Here????
Thank u
Prime or not Prime
Number of divisors of each number from 1 to N
Sieve of Erastothenes
GCD
Modular Aritihmetic (
Add,
Subtract,
Multiply,
Pow(Binary Exponentiation),
Fermat's Little Theorem to get (1/a)%M we get pow(a,M-2)%M where M is prime number divisor,
)
Combinatronics: nCr calculation in linear time using fact and inv_fact array (Usually paired with %M problems)
tqtq for thisone ❤️