Maths for DSA/CP : All You Need To Know

Поділитися
Вставка
  • Опубліковано 26 сер 2024

КОМЕНТАРІ • 212

  • @debjitdasgupta5502
    @debjitdasgupta5502 2 роки тому +88

    Don't stop the DSA/CP series! Amazing video as usual!!

  • @harshpandey4190
    @harshpandey4190 7 місяців тому +10

    Best Video on number theory by Best of the Community

  • @AviralDewan
    @AviralDewan 2 роки тому +90

    Bro please make a video on dynamic programming

  • @girishbhargava6367
    @girishbhargava6367 2 роки тому +4

    I really respect the people who add time stamps in their videos

  • @sivasainagireddi7956
    @sivasainagireddi7956 2 роки тому +19

    Exactly this is what I m searching for for.
    GREAT EXPLANATION

  • @yashrajadmane
    @yashrajadmane 2 роки тому +10

    Not all heroes wear capes.. Some make DSA videos on YT.
    Thanks brother 🙌

  • @pksk7952
    @pksk7952 2 роки тому +52

    please make more videos please increase the frequency as this is kind of content we want!

  • @harshit_gajera
    @harshit_gajera Рік тому +8

    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.

  • @ANANDKUMAR-jk9yp
    @ANANDKUMAR-jk9yp 2 роки тому +26

    By the way, time complexity of gcd is log(min(a,b)).

  • @SunilKumarGvBLC
    @SunilKumarGvBLC 2 роки тому +10

    In 24:03, while explaining sieve of eratosthenes, the upper for loop should go from 2 to i * i

    • @utkarshgupta9858
      @utkarshgupta9858  2 роки тому +7

      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

    • @SunilKumarGvBLC
      @SunilKumarGvBLC 2 роки тому +2

      Got it brother! Thanks for your instant reply!

    • @sachinupreti7159
      @sachinupreti7159 2 роки тому +1

      @@utkarshgupta9858 sun yr, bit manipulation pe bhi sikha de kuxh...

    • @justworkfine321
      @justworkfine321 2 роки тому

      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

    • @shantivaranasi231
      @shantivaranasi231 2 роки тому

      @@utkarshgupta9858 can u share related problems of these topics

  • @surajkumar-ze5jl
    @surajkumar-ze5jl 2 роки тому +4

    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.

    • @Atvkaur1111
      @Atvkaur1111 2 роки тому

      CP course is paid or free?

  • @codenchill732
    @codenchill732 2 роки тому +44

    Please make a video on bit manipulation. Especially on XOR operation

    • @yath3681
      @yath3681 2 роки тому +2

      yes , please !
      everything about bitwise operator questions in CP

  • @ANILKUMAR-mi5xm
    @ANILKUMAR-mi5xm 2 роки тому +4

    Wow! Modulo inverse and Fermat theorem Explanation I will never forget, ❤❤❤❤.

  • @jitendrakhanna4426
    @jitendrakhanna4426 2 роки тому +38

    From where you learn all these things or just while practicing you learn..

  • @tessabloomx8660
    @tessabloomx8660 2 роки тому +6

    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.

  • @Entertainment15683
    @Entertainment15683 2 роки тому +3

    Oh finally you are back 😊 :))) much more love to you bhaiya

  • @theresweet984
    @theresweet984 2 роки тому +7

    Hola, Utkarsh Gupta!
    Please keep it up this kind of competitive edu series. Thanks!

  • @Sandeep-zd6dq
    @Sandeep-zd6dq 2 роки тому +6

    Bhai mujhe bhi 7 star banna hai 😢 jbse tumhari AIR 1 waali video dekhi hai tumhe follow kr rha hu lekin abhi 3 start bna hu 1 mahine mein😎 jaldi hi seven bhi bnunga

  • @shubhamchidrawar9477
    @shubhamchidrawar9477 2 роки тому +5

    Awesome video!
    This is very high quality content, Eagerly waiting for the second part.

  • @abhishekmore5856
    @abhishekmore5856 8 місяців тому +1

    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)!

  • @apoorvamittal4112
    @apoorvamittal4112 2 роки тому +7

    just the person I was looking for, thanks 🙌

  • @tirthasg
    @tirthasg 2 роки тому +10

    Your explanations are great. Well done!

  • @codeblooded6760
    @codeblooded6760 2 роки тому +51

    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!

  • @jayantgupta5310
    @jayantgupta5310 2 роки тому

    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

  • @sherlockjunior8612
    @sherlockjunior8612 Рік тому +3

    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)

  • @rajukachori9536
    @rajukachori9536 2 роки тому +5

    SIR UR DOING GREAT JOB FOR US ...THANKU PLEASE MAKE MORE THIS VIDEOS .WE GET TO LEARN MANY THINGS FROM IT

  • @Profnegi
    @Profnegi 7 місяців тому

    Today i start cp and learning from grandmaster directly.. like wow this is amazing! Lot of resp++

  • @saurabhkumarchoudhary1795
    @saurabhkumarchoudhary1795 2 роки тому

    This is the thing I was waiting from past 4 years

  • @manayyadav4911
    @manayyadav4911 2 роки тому +18

    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.

    • @humanbeing6042
      @humanbeing6042 2 роки тому

      Checkout Luv competitive programing course playlist.The second video completely about setup Link: ua-cam.com/video/Zlx7gmt3lBU/v-deo.html

    • @manayyadav4911
      @manayyadav4911 2 роки тому

      @@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 :(

    • @johntony366
      @johntony366 2 роки тому

      You can use WSL to get the linux experience on windows

  • @ananyasuryavanshi2800
    @ananyasuryavanshi2800 2 роки тому +3

    Please make one whole video explaining time-complexity also.

  • @yashvaibhav925
    @yashvaibhav925 2 роки тому +6

    You explained sieve at minute number 22. The inner iteration should rather start from square of i and not just 2i. When you unset all multiples of 2, you're offsetting 4,6,8 and the rest. Notice how these have paved way for remaining 3,5 and 7 to be primes already. So when checking for 3, you should begin with 9 and not 6.

    • @yashvaibhav925
      @yashvaibhav925 2 роки тому +3

      UPDATE: Sorry for commenting too soon. You explained this just 10 seconds later.

  • @aryankumar87771
    @aryankumar87771 Рік тому +2

    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

    • @ritvikreddy3959
      @ritvikreddy3959 Рік тому

      removing the nested if won't reduce the time complexity it will still be O(root(n))

  • @AkhileshSingh-wq6gt
    @AkhileshSingh-wq6gt 2 роки тому +1

    Thank you Bhaiya...
    Modular Arithmetic part taught me something new.. 😊

  • @RahulSingh-nf3dr
    @RahulSingh-nf3dr Рік тому +1

    27:50
    time complexity should be O(log(min(a,b)))
    correct me if I am wrong

  • @deepakbhoria4172
    @deepakbhoria4172 10 місяців тому

    thanks for explaining modulo arithmetic in full details !!! great work

  • @aayushverma5121
    @aayushverma5121 2 роки тому +5

    Just the content I was looking for !
    Thank you for the video

  • @shresthjain985
    @shresthjain985 2 роки тому +1

    Crisp and to the point content. Well Done.

  • @DeepakKumar-mn7sp
    @DeepakKumar-mn7sp 2 роки тому +3

    How to setup sublime like that in 5:30 , the TC part ?

  • @vivekdhir77
    @vivekdhir77 2 роки тому +2

    Nice, bro long time no see. I was waiting.....

  • @user-ti3bd8mp1w
    @user-ti3bd8mp1w Рік тому +3

    primality test 3:27
    gcd 24:37
    modular arithmetic 30:52
    pnc 59:04

  • @himanshu010
    @himanshu010 2 роки тому +1

    Gread content Grandmaster. Keep uploading. 🤝

  • @Manish_Upadhyay
    @Manish_Upadhyay 2 роки тому +4

    You are inspiration for me ❤️✨

  • @Advebtures-hx4hv
    @Advebtures-hx4hv 2 роки тому +1

    Please make a video for greedy it is very helpful

  • @anexocelisia9377
    @anexocelisia9377 2 роки тому +29

    How you've managed your hectic curriculum of college with the immense practice of cp? Please reply!

    • @abhinavshukla5164
      @abhinavshukla5164 2 роки тому

      What hectic ciriculum of college 🤣🤣r u joking ,nothing hectic ,it's chil

  • @dhananjaysharma4379
    @dhananjaysharma4379 2 роки тому +2

    very nice explanation, just adding the practice questions related to the concepts would be even better.

  • @Ram-uf8mv
    @Ram-uf8mv 2 роки тому +4

    in pw(a, b, m), when b is 0, why are you returning a % m? it should always be 1 right?

    • @utkarshgupta9858
      @utkarshgupta9858  2 роки тому +5

      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

  • @ascyrax8507
    @ascyrax8507 2 роки тому +1

    I used to dread Modular multiplicative inverse. Not anymore 😌

  • @AshishGusain17
    @AshishGusain17 2 роки тому +2

    42:21 shouldn't base case return 1

  • @rahul_singh_rajput3292
    @rahul_singh_rajput3292 2 роки тому +1

    Bhaiya plS make video on how to Start for CP.. How should we learn Dsa correcr way

  • @tejaswarade3785
    @tejaswarade3785 2 роки тому +1

    can you please give practice problems on Maths part in DSA

  • @vtechrepo1927
    @vtechrepo1927 2 роки тому +1

    after so long
    wating for this video

  • @jiakai7254
    @jiakai7254 10 місяців тому

    if you prefer a textbook, consider the competitive programmers handbook :)

  • @DeepakKumar-mn7sp
    @DeepakKumar-mn7sp 2 роки тому +1

    At 23:55 that sieve template, how the whole template code arrives just by typing sieve?

  • @murtazamister8125
    @murtazamister8125 2 роки тому +1

    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?

  • @allmighty2000
    @allmighty2000 2 роки тому

    the nlogn proof was amazing

  • @abhishekkeshri3974
    @abhishekkeshri3974 2 роки тому +1

    Thanks for this. It really helps me a lot .

  • @random_memes009
    @random_memes009 2 роки тому +1

    Hwy, plz make video on time complexity. Thk yu for helping us

  • @samanwaybarman3316
    @samanwaybarman3316 2 роки тому

    Searching and sorting and precomputation

  • @arsh2489
    @arsh2489 Рік тому

    this video changed my life beta 👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌👌

  • @cypher7536
    @cypher7536 2 роки тому +1

    Bro please tell how to make sublime like yours

  • @parthsalat
    @parthsalat 2 роки тому +1

    Amazing content, as usual!

  • @notlinuxneverdies5846
    @notlinuxneverdies5846 2 роки тому +1

    Thank you sooo much!!!

  • @rishav144
    @rishav144 2 роки тому +2

    kindly continue with Graph series

  • @darshanmahankar6626
    @darshanmahankar6626 2 роки тому

    The Speed at which complier is working and Set-up is made
    ....i am desparately waiting when that content would be Up on channel 🙂🤝💔

  • @sahilanand30
    @sahilanand30 2 роки тому +1

    Nice explanation

  • @wondol4486
    @wondol4486 2 роки тому +1

    This is perfect lecture

  • @algotalk5368
    @algotalk5368 2 роки тому +1

    Please update this slide

  • @pronoob5664
    @pronoob5664 2 роки тому +1

    Thank you LORD DEMORALIZER

  • @arsh2489
    @arsh2489 Рік тому

    this changed my cp career ❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤😍😍😍😍😍😍😍😍😍😍

  • @PrinceKumar-uz9xv
    @PrinceKumar-uz9xv 2 роки тому

    thanks, ❤ bhaiya I wanted this type of video.

  • @Reyna-yj6vo
    @Reyna-yj6vo 12 днів тому

    casually explaining sieve of erathosthenous

  • @arnabchakraborty246
    @arnabchakraborty246 2 роки тому

    Grt video. Please share some problem set to practice

  • @simranvedpathak7112
    @simranvedpathak7112 2 роки тому +2

    🔥🔥

  • @sandeepsharma2183
    @sandeepsharma2183 2 роки тому

    Most awaited video♥️♥️

  • @lemmaop7720
    @lemmaop7720 2 роки тому +4

    Bro Dynamic Programming Playlist Is Needed

  • @abhishekkumar-vk8kc
    @abhishekkumar-vk8kc 2 роки тому

    Sir please make video on dp and graphs from basic to advanced

  • @sumeetubale3923
    @sumeetubale3923 Рік тому +1

    hi utkarsh bhaiyya ,at time 56 : 00 the code is giving wrong output for input a=156 b = 4 and m = 7 could you plz verify it where I can go wrong !! and thank you so much for this amazing video !! just loved it!! plz don't stop ever to make video related to cp

    • @utkarshgupta9858
      @utkarshgupta9858  Рік тому +1

      i made a small mistake in the code, if power is zero, we should return 1 instead of a.

    • @sumeetubale3923
      @sumeetubale3923 Рік тому

      @@utkarshgupta9858 ok thank you bhaiyya!!

  • @abhinavkumar5298
    @abhinavkumar5298 Рік тому

    Amazing Video.

  • @Aditya-if3ij
    @Aditya-if3ij 2 роки тому

    Purple is my aim for this year.

  • @sakshamgulati5854
    @sakshamgulati5854 2 роки тому

    Bhaiya other topics ki bhi detailed videos bana do please jo cp mei important hote hai..🙏

  • @TilakRaj-qo6ic
    @TilakRaj-qo6ic 3 місяці тому

    Can someone please tell me which software he used to create thie presentation please

  • @035asadali8
    @035asadali8 2 роки тому

    i thought i know very lesss but after seeing todays video i understand i know all topics he discuss today and even more he not add

    • @AjithKumaR-jw9wt
      @AjithKumaR-jw9wt 2 роки тому

      Where u learn all this things

    • @035asadali8
      @035asadali8 2 роки тому

      @@AjithKumaR-jw9wt few days ago and still learning , if u want to understand number theory try code n code number theory playlist

    • @AjithKumaR-jw9wt
      @AjithKumaR-jw9wt 2 роки тому

      @@035asadali8 bro any prerequisite to learn number theory

    • @AjithKumaR-jw9wt
      @AjithKumaR-jw9wt 2 роки тому

      @@035asadali8 what are the topics we want to cover in dsa before cp

    • @035asadali8
      @035asadali8 2 роки тому

      @@AjithKumaR-jw9wt for number theory no prerequisite needed

  • @amitai8204
    @amitai8204 5 місяців тому

    thank you very much! very helpfull!

  • @muthupandideivamsanmugam1774

    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

  • @anupamdubey5736
    @anupamdubey5736 2 роки тому

    Awesome class!

  • @crazyteam9370
    @crazyteam9370 2 роки тому

    Hello brother ! Please make a video on how to setup Sublime text as you had in your laptop

  • @BRAJESHKUMAR-lz4mw
    @BRAJESHKUMAR-lz4mw 2 роки тому

    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?

  • @vaibhavjaiswal8034
    @vaibhavjaiswal8034 2 роки тому +1

    Please Use black background (dark mode)

  • @MdMaruf-ln9pv
    @MdMaruf-ln9pv 8 місяців тому

    sir can you please tell me from where you learned all this topics??

  • @chatrughanprasad7778
    @chatrughanprasad7778 2 роки тому

    Great Lecture Bro!

  • @unaizsiddiqui3892
    @unaizsiddiqui3892 2 роки тому

    Brother, i love to watching your video...
    But i have a problem, why you don't make a video in hindi...
    Hum bachee hai bhaiya hindii me explain karoo ge to...or ache se samj ayega...and channel bhi fast grow karega...(padhee ga india to badhega india)💫♥️

  • @realnight_bot2536
    @realnight_bot2536 2 роки тому

    Are JOD sir 🤩

  • @Impromptu21
    @Impromptu21 5 місяців тому

    but usually we have mod as 10^9+7 so how are we gonna calculate the multiplicative inverse. b^m-1. ...blaaaaaa

  • @vanquishersgaming138
    @vanquishersgaming138 2 роки тому

    You're awesome 🙌

  • @gandhijainamgunvantkumar6783
    @gandhijainamgunvantkumar6783 2 роки тому

    why you have declared fact[N], but it should be fact[N+1] because we also have to store factorial of N

  • @lakeshkumar1281
    @lakeshkumar1281 2 роки тому

    simply awesome

  • @_wassaname_
    @_wassaname_ 2 роки тому +1

    bhai complete course bana de pls
    udemy pe daal dena par complete course bana de

  • @shubh4096
    @shubh4096 2 роки тому

    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!

  • @ddnsdeepak8148
    @ddnsdeepak8148 2 роки тому

    Bro please make a video on your sublime text setup of U .

  • @ffera6611
    @ffera6611 2 роки тому

    please add graph videos also like this one