Nth Root of a Number using Binary Search | CP Course | EP 42

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ธ.ค. 2024

ความคิดเห็น • 111

  • @puspaulmukhopadhyay2358
    @puspaulmukhopadhyay2358 2 ปีที่แล้ว +6

    Thank U very much !

  • @dipubiswas8569
    @dipubiswas8569 2 ปีที่แล้ว +8

    You are the best teacher on TH-cam I have ever found and I learn my best lesson about CP from you.
    Thank you sir. Thank you very very much.

  • @abdullah6055
    @abdullah6055 3 ปีที่แล้ว +30

    I can see how you are working on your video making style compared to the previous videos. Keep improving you're doing great job . Much love❤️

  • @178fahimahmed7
    @178fahimahmed7 3 ปีที่แล้ว +6

    Interesting concept!!! And yah when I first saw the title I was curious about the video. Keep on going. ❤️

  • @darad_yash
    @darad_yash 3 ปีที่แล้ว +15

    I just randomly clicked this video, and now I'm in love with it. Keep going and upload great videos like these❤️

    • @iamluv
      @iamluv  3 ปีที่แล้ว +8

      you can check the course playlist, its filled with videos like these

  • @barnikroy5244
    @barnikroy5244 3 ปีที่แล้ว +5

    sure it is now the most underrated channel ....but i can visualize the upcoming million subscribers of this channel

  • @shakshi9108
    @shakshi9108 3 ปีที่แล้ว +3

    Maja aa Gaya bhaiya,bohot detailed aur easy explanation tha

  • @programmertik2046
    @programmertik2046 3 ปีที่แล้ว +3

    Dedication = Luv editing the correction in video and not in comment 🤩🤩👌

  • @psibarpsi
    @psibarpsi 3 ปีที่แล้ว +1

    Wow! This video really was The Answer to Life, The Universe and Everything!
    ;)

  • @154bharshbhanushali9
    @154bharshbhanushali9 2 หลายเดือนก่อน +2

    Just a simple experience ,
    Kabhi bhi contests mein in built pow function mat use karna becoz I don't know why voh kabhi kabhi kuch int/float kuch dikkat ki vajaah se round off karke small answer deta h , mera iski vjaah se contest mein 1 hour kharaab hogya tha , That's it ! I hope it will help

  • @factswithai2
    @factswithai2 3 ปีที่แล้ว

    luv is love, bhai tum videos banate raho, mein placement ki tayari krta rahunga, aur place hote hi tumhe bataunga

  • @parthkabra8880
    @parthkabra8880 3 ปีที่แล้ว +3

    love u thanks for a perfect series!

  • @parthkabra8880
    @parthkabra8880 3 ปีที่แล้ว

    only 1k views for a perfect video!!!!!!!!!!!!!?
    this content deserves over 1B+ views

  • @itsmesohit
    @itsmesohit 3 ปีที่แล้ว +1

    Nice explanation of binary search.

  • @simranvedpathak7112
    @simranvedpathak7112 3 ปีที่แล้ว +1

    Thank you bhai! 😇

  • @tejassrivastava6971
    @tejassrivastava6971 3 ปีที่แล้ว +1

    Greatly explained

  • @avinashbiradar9953
    @avinashbiradar9953 2 ปีที่แล้ว

    amazing luv bhaiyya keep it up !!

  • @thomaspandey3661
    @thomaspandey3661 3 ปีที่แล้ว

    absolute gem🙌🙌

  • @stevefox2318
    @stevefox2318 3 ปีที่แล้ว +1

    thanks, bro great approach

  • @bhailog_gaming_2000
    @bhailog_gaming_2000 3 ปีที่แล้ว

    Totally appreciate your efforts bhaiya!! Great work!

  • @AdityaSingh-ql9ke
    @AdityaSingh-ql9ke 3 ปีที่แล้ว +6

    #Luv
    Time Complexity : depends on the precision and nth root.

    For 2 decimal places precision, the search space between 2 consecutive numbers will become : 100
    So, say : 0---4 with 2 decimal places precision. x = 4, whose nth root has to be found & d = precision value
    Search Space : 0---1, 1---2, 2---3, 3---4 ===> 100*4=400
    So search space = x * ( 10^d ),

    Since binary search will be applied here, so time complexity : log ( x * ( 10^d ) )---->base is 2
    Now, further, if we want nth root, then we will have to check each number by multiplying it n times : a^n = x,
    So total time complexity : n * log 2 ( x * ( 10^d ) )

  • @manu-singh
    @manu-singh 3 ปีที่แล้ว +8

    Hi bro I recently started learning from your playlist, I want to ask how should I practice problems after watching your video about a specific topic??

    • @iamluv
      @iamluv  3 ปีที่แล้ว +12

      go to any coding websites and search for questions of that topic and try to solve in lot of video questions links are also given in video description.

  • @niloy.learner
    @niloy.learner 3 ปีที่แล้ว

    Wow! Amazing!

  • @hope-jh7bv
    @hope-jh7bv 3 ปีที่แล้ว

    Really good explanation. Thank you so much sir.

  • @ayushthakur733
    @ayushthakur733 3 ปีที่แล้ว

    If TH-cam had a feature of multiple likes I would have given a million likes to this one

  • @-RohitJaiswal
    @-RohitJaiswal 3 ปีที่แล้ว +2

    Couldn't we directly while(hi>lo) instead of while(Hi-Lo>eps)
    BTW thank you very much for the gr8 video ❤️❤️❤️

    • @iamluv
      @iamluv  3 ปีที่แล้ว +18

      it will run infinitely as high and lo will never become equal, as there will always exist a unique (hi+lo) /2 for two given hi and lo. We are not dealing with integers here we are dealing with decimals.

    • @-RohitJaiswal
      @-RohitJaiswal 3 ปีที่แล้ว +3

      @@iamluvOhhh gr8 , Thank you very much ❤️

  • @Nishant89-i2z
    @Nishant89-i2z 3 ปีที่แล้ว

    Bahiya you are doing great jobs for free which means great and the content is also great thanks for this comptetive web series

  • @rekildo
    @rekildo 2 ปีที่แล้ว +1

    HELP !!!
    if low = mid and high = mid
    let say we need to find sqrt of 16 , so acc to above conditions [do dry run for number 16] (low wil become 3 at last ) (and high would become 4) then 3 + 4 = would always give me 3 point something.
    how is the code giving us ans 4; if the (3 + 4 is always giving me 3 point x).

  • @ananyapamde4514
    @ananyapamde4514 ปีที่แล้ว

    God bless you

  • @MasumExtended-jt4ty
    @MasumExtended-jt4ty 11 หลายเดือนก่อน

    OP vai😁😁😁😁

  • @himanshugarg08
    @himanshugarg08 3 ปีที่แล้ว +1

    thankyou so much bhai sari videos ek dum mast haii bahut kuch sikhne ko mill raha haii kabhi kabhi mann nahi karta video dekhne ka pr jaise hi on karta hu puri dekh leta hu aurr vo bhii interest ke sath. Bhai ek cheez ye kuch planned haii kyaa ki kabb takk over ho jayega course? and kuch questions ki list type se de sakte ho kyaa for practice bahut sare haii choose nahi kr pa rahe ki kaun se karne chaiye

    • @iamluv
      @iamluv  3 ปีที่แล้ว +2

      jin topics me mere pass particular list hoti hai un topics me list de deta hu mai generally, jinke liye nhi hoti vo kaise dunga. As such koi idea nhi hai muje kab tak khatam hoga, all i know is i try to put two videos a week, jab topics over ho jayenge kahtam ho jayega.

  • @kunalaggarwal1928
    @kunalaggarwal1928 3 ปีที่แล้ว +2

    can"t we do --> lo= mid+eps in the if statement so that it resembles the algo in previous videos.

    • @harsh.sharma
      @harsh.sharma 2 ปีที่แล้ว

      I think yes. we can do. but the ans still remains the same.

  • @mjustboring
    @mjustboring 3 ปีที่แล้ว

    luv you luv bhai... 😁❤️

  • @kunalshinde3488
    @kunalshinde3488 3 ปีที่แล้ว +2

    Bhai string k competitive programming wale questions kab aaenge . Like longest palindromic subsequence , interleaving etc. Please make it ASAP plss🙏🙏

  • @mr_atul_
    @mr_atul_ 3 ปีที่แล้ว

    Where u got that much knowledge 🤞🤞

  • @kamalkumar945
    @kamalkumar945 3 ปีที่แล้ว

    thanks a lot bhaiya

  • @rudrapratap3303
    @rudrapratap3303 3 ปีที่แล้ว

    Thanks you ❤️

  • @vishnuagrawal5730
    @vishnuagrawal5730 3 ปีที่แล้ว

    Luv sir, plz make video on sliding window technique.

  • @Shubham-bk2cf
    @Shubham-bk2cf 3 ปีที่แล้ว +6

    bhaiya kabhi views ke chakkar mai mat rehna kyunki minimum 4,5 log toh sincerely follow kar rehe honge maximum pata ni ...CP samjne ke liye aap pe hi dependent hun mai :)

  • @ShubhamKumar-et7gx
    @ShubhamKumar-et7gx 2 ปีที่แล้ว

    last me lo hi kase kuch bhi return kr denge..mid return krna ciye na

  • @kaukuntlaprudviraj108
    @kaukuntlaprudviraj108 2 ปีที่แล้ว

    Bro plzz continue keeping videos plzzz

  • @jayadubey_22
    @jayadubey_22 3 ปีที่แล้ว

    thanks bhaiya

  • @barnikroy5244
    @barnikroy5244 3 ปีที่แล้ว +1

    Please please bhaiya.....rukna mat ye course

    • @iamluv
      @iamluv  3 ปีที่แล้ว +3

      nhi rukenge bhai

    • @barnikroy5244
      @barnikroy5244 3 ปีที่แล้ว

      @@iamluv we all have great faith in you bhaiya

  • @ram9523
    @ram9523 3 ปีที่แล้ว

    Superb

  • @everythingtoknow5388
    @everythingtoknow5388 3 ปีที่แล้ว

    Subscribed 👍👍👍

  • @tarunpreetsingh7243
    @tarunpreetsingh7243 3 ปีที่แล้ว +1

    Hey, could you tell me why is hi=mid and not hi=mid-eps?

    • @iamluv
      @iamluv  3 ปีที่แล้ว +3

      Because doing that you could miss the actual square root as square root can lie between hi - eps and hi

    • @ashutoshkumarchoudhary6420
      @ashutoshkumarchoudhary6420 2 ปีที่แล้ว

      @@iamluv So can we declare eps li 1e-8 so that we wont miss?

  • @anantmouraya8113
    @anantmouraya8113 2 ปีที่แล้ว

    bhai cout 6 precision tak print karta hai.
    double a=(2.00001+1.99998)/2;
    cout

  • @ajinkyadeshpande3992
    @ajinkyadeshpande3992 2 ปีที่แล้ว

    Why is "lo" made mid not mid + 1?

  • @ProjectPros
    @ProjectPros 3 ปีที่แล้ว +1

    How can we recognise that problem get solved by which method. If any trick is there please share.

    • @iamluv
      @iamluv  3 ปีที่แล้ว +1

      there is no trick, you learn with experience and solving more and more problems.

  • @satyamkumarrai6112
    @satyamkumarrai6112 ปีที่แล้ว

    Is wale binary search pe low=mid+1 kyu nehi liya, thora ache examples seh bata sakte ho? bhaiya

  • @aniketash4738
    @aniketash4738 3 ปีที่แล้ว

    bro i have confusion in mid*mid

    • @iamluv
      @iamluv  3 ปีที่แล้ว +1

      why low+eps would b there, we just need decrease search space into half at every step, and get closer to actual square root, hence lo= mid works properly.low+eps could lead to miss of actually number which was there.

  • @AnandSingh-zm5cm
    @AnandSingh-zm5cm 3 ปีที่แล้ว

    During finding mid=l+h/2 all are integeres ,so calculation never go in double?

    • @privacysimplified2580
      @privacysimplified2580 3 ปีที่แล้ว +1

      you need to work more on basic or maybe you need a pair of glass

    • @privacysimplified2580
      @privacysimplified2580 3 ปีที่แล้ว

      all the variables are double. if you can't figure out

    • @harsh.sharma
      @harsh.sharma 2 ปีที่แล้ว +5

      @@privacysimplified2580 Can't you be a bit humble

  • @getconcept
    @getconcept 3 ปีที่แล้ว

    Isme bhaiya aap kaise pahchane ki high=mid hoga ,not mid-1?

  • @Mayank-lf2ym
    @Mayank-lf2ym 3 ปีที่แล้ว

    Big fan

  • @aayush5474
    @aayush5474 3 ปีที่แล้ว

    Why is p outside log(N*10^N) shouldn't p be inside the log?

    • @iamluv
      @iamluv  3 ปีที่แล้ว

      no, p is the pth root, for every while loop iteration we have o(p) loop, log ke anadar sirf search space ka size ayega basically while loop kitni baar chlega and while loop kitni baar chlega doesnt depend on p

  • @paraskumar693
    @paraskumar693 ปีที่แล้ว

    We can also do like
    while(lx){
    high=m-eps;
    }else{
    low=m+eps;
    }
    }
    return h;

    • @surendersingh5898
      @surendersingh5898 ปีที่แล้ว

      can u tell me why we didnt put lo=mid and high=mid+1 in the video?? Is it cause we r dealing with decimals here and its multiplication...or its alright if u use high= mid+1 or high = mid

  • @bohotsaaridhop
    @bohotsaaridhop 3 ปีที่แล้ว +1

    Bhaiya I have a query related to Software Development, Bhaiya I am doing this C++ course and side by side I am doing DS & ALGORITHMS in C++ only, Bhaiya I am in 2nd year and I want to know ki what I have to do in Software Development and should I continue on what I am doing or start to learn about development know? Also my teachers are telling me to shift to Java,but I like C++ batana Bhaiya kya karu?

    • @iamluv
      @iamluv  3 ปีที่แล้ว

      do what you like

    • @bohotsaaridhop
      @bohotsaaridhop 3 ปีที่แล้ว +1

      @@iamluv bhaiya Software Development ke liye kuch na karu phr?

    • @devkumar9889
      @devkumar9889 3 ปีที่แล้ว

      This code is working fine for non perfect square no. But it's giving two diff val of hi and lo for perfect squ no.s

    • @piyushgarg41
      @piyushgarg41 3 ปีที่แล้ว

      @@devkumar9889 no it's working fine for perfect square no. Also

  • @salma-sx8um
    @salma-sx8um 3 ปีที่แล้ว +1

    4 decimal places ke difference toh minimum 0.0001 hota hai toh usko four zeroes kyu rakhe.....
    please koi explain karo

    • @piyushgarg41
      @piyushgarg41 3 ปีที่แล้ว

      Because if we want upto 4 decimal accurate answer then we need 4 zeros after decimal

  • @praviiiin
    @praviiiin ปีที่แล้ว

    someone explain the time complexity explanation

    • @praviiiin
      @praviiiin ปีที่แล้ว

      got it

    • @Cpp_For_Life
      @Cpp_For_Life 8 หลายเดือนก่อน

      Ur cf rating now?

  • @DeepakKumar-xy8rw
    @DeepakKumar-xy8rw 3 ปีที่แล้ว

    Sir for practice questions , multiple coding platform use karna cahiye ya only codeforces, codechef, leetcode se hi acha se karna hai ? If u have any suggestions then please tell me .

    • @iamluv
      @iamluv  3 ปีที่แล้ว +2

      use nay , main aim is to solve more questions do what you feel comfortable with.

  • @parthkabra8880
    @parthkabra8880 3 ปีที่แล้ว +1

    1st view bhai!

  • @HashTag1643
    @HashTag1643 3 ปีที่แล้ว

    First comment ❤️❤️

  • @AdarshSenSingh-t6r
    @AdarshSenSingh-t6r 11 หลายเดือนก่อน

    #include
    #define int long long
    #define ld long double
    #define fi first
    #define se second
    #define vi vector
    #define vvi vector
    #define pb push_back
    #define all(a) (a).begin(),(a).end()
    #define f(i,x,y) for(ll i=x; i>t;

    ld eps= 1e-6;
    // cout

  • @vaibhavkumar1391
    @vaibhavkumar1391 3 ปีที่แล้ว

    Sequence, subsequence, subarray etc. of string aur array pr bhi questions bnaye bhaiya ji.🙏
    Ye questions nhi bnte h mere se, aur bhut baar campus exam se out bhi ho chuka hu en sbhi questions ke karan 😞

    • @iamluv
      @iamluv  3 ปีที่แล้ว +3

      there is not single technique to solve those kind of problems, generally those questions use concepts all over the place, there i no particular method to solve those problems. Almost of the time logic is different. Just read their solutions if you are not able to solve and you will understand what i am trying to say.

  • @AgnivaBanerjee6
    @AgnivaBanerjee6 3 ปีที่แล้ว

    Thank you sir!

  • @HashTag1643
    @HashTag1643 3 ปีที่แล้ว +1

    Bhai aapne BTech kiya h kya

    • @Justin-nw7xi
      @Justin-nw7xi 3 ปีที่แล้ว

      check his linkedin profile from description

    • @pranshul..
      @pranshul.. 3 ปีที่แล้ว

      Channel ke about mei bhi likhaya hai derails

  • @ShivamVerma-gq2sm
    @ShivamVerma-gq2sm 3 ปีที่แล้ว

    Why are we not doing here . Low=mid+epsilon ?

    • @iamluv
      @iamluv  3 ปีที่แล้ว +1

      how is high = mid + epsilon making any sense ? , you are increasing the value of high ?, in case you meant low = mid + epsilon, we are not doing that here because we are dealing with doubles, if sqrt lies between mid and mid + eps, you will loose it.

    • @ShivamVerma-gq2sm
      @ShivamVerma-gq2sm 3 ปีที่แล้ว

      @@iamluv yeah, I meant low only. I mentioned it this way since we wanted accuracy 10 times the epsilon. So why it will make any difference. Moreover, I came up with this idea from the trivial Binary search. Anyways I understood your explanation, thankyou for your time.

  • @vaibhavpandey2286
    @vaibhavpandey2286 3 ปีที่แล้ว

    First view and comment

  • @asianguy86
    @asianguy86 ปีที่แล้ว

    can you explain it again

  • @sumitkamble_
    @sumitkamble_ 3 ปีที่แล้ว

    👍👍❤️

  • @good114
    @good114 2 ปีที่แล้ว

    💕❤️

  • @sajidrec
    @sajidrec 3 ปีที่แล้ว

  • @tiger20studio80
    @tiger20studio80 3 ปีที่แล้ว

    AlexA STOP !!🤣😂😂😂

  • @prernatwinkle2117
    @prernatwinkle2117 2 ปีที่แล้ว

    Just a comment to increase reach.

  • @sakhawat_100
    @sakhawat_100 ปีที่แล้ว

    by the way who is Alexa

  • @sahiljangra1469
    @sahiljangra1469 ปีที่แล้ว

    Samjha toh bhai ...itna toh hme bhi pta h .....kuch nye dhang se bta ...video nhi achi lagi😢

  • @tradewithajay01
    @tradewithajay01 ปีที่แล้ว

    Bekkar video kuch samjh nhi aaya

  • @tanaysingh5348
    @tanaysingh5348 ปีที่แล้ว

    really well explained