Karatsuba Algorithm Explained with Examples

Sdílet
Vložit
  • čas přidán 2. 07. 2020
  • Karatsuba Fast multiplication algorithm is explained with examples in this video tutorial for n digit by n digit multiplication. It is shown how the complexity of multiplication is reduced from O(n^2) of traditional grade school multiplication to O(n^1.6) of faster multiplication using Karatsuba method. This result in reduced computation time to achieve large n digit by n digit multiplication.
  • Věda a technologie

Komentáře • 31

  • @areyouraphael
    @areyouraphael Před 3 lety +9

    I don't know why geeks for geeks and Briliant use such confusing math jargon. This video helps lots!

    • @STEMprof
      @STEMprof  Před 3 lety +2

      Thanks Zeon! glad that video is helpful.

  • @brianbrennglass8012
    @brianbrennglass8012 Před 3 lety +19

    This is the first time I have ever commented. Your video helped solidify concepts that I'm learning through a Coursera course. Your explanation is more succinct and graspable than Columbia professor Tim Roughgarden's

    • @STEMprof
      @STEMprof  Před 3 lety +1

      Appreciate your comment & feedback. Glad to hear that the video is helpful.

  • @srikanthpanasa9648
    @srikanthpanasa9648 Před 3 lety +3

    It helped me in my research, thanks for the video

    • @STEMprof
      @STEMprof  Před 2 lety

      Thanks Srikanth. Appreciate your comment.

  • @animohene8304
    @animohene8304 Před 2 měsíci +1

    Thank you for the break down and great explanation

    • @STEMprof
      @STEMprof  Před 2 měsíci

      You're welcome. Glad that you liked this video. The Generalization of Karatsuba Algo, Toom-Cook (Toom3) is also explained with Examples in this follow-up video: czcams.com/video/1XiSyNzMX6Q/video.html that I hope is interesting as well. 🙋‍♂️

  • @sfallon7
    @sfallon7 Před 9 měsíci +1

    Thank you for this great explanation.

    • @STEMprof
      @STEMprof  Před 9 měsíci

      You are welcome. Thank you for watching. Glad that this Karatsuba Algorithm video is helpful.

  • @amisaraaah
    @amisaraaah Před 3 lety +3

    thank you for ur help 🙏

    • @STEMprof
      @STEMprof  Před 3 lety

      You are welcome! Glad that this video is helpful.

    • @amisaraaah
      @amisaraaah Před 3 lety +1

      @@STEMprof pls provide Toom Cook3 multiplication as well 🙏🏼

    • @shubhampandey4284
      @shubhampandey4284 Před 3 lety +1

      @@amisaraaah yes sir

    • @STEMprof
      @STEMprof  Před 7 měsíci

      @@amisaraaah Sure, Toom-Cook (Toom3) Algorithm Explained with Examples (Generalization of Karatsuba Algo) in this follow-up video: czcams.com/video/1XiSyNzMX6Q/video.html

  • @wafikiri_
    @wafikiri_ Před 10 měsíci +3

    A recursive cascading algorithm until only single digit multiplications are involved, then cascading back to sum results. Not too easy, but not too difficult, either. I've coded worse recurrent things.

  • @STEMprof
    @STEMprof  Před 7 měsíci

    The Generalization of Karatsuba Algo, as Toom-Cook (Toom3) Algorithm is also explained with Examples in this follow-up video: czcams.com/video/1XiSyNzMX6Q/video.html
    Also an interesting sorting in Python is duscussed in czcams.com/video/JB60xI1eTT8/video.html
    I hope these videos are useful as well. 🙋‍♂️

  • @bonbonpony
    @bonbonpony Před 3 lety +1

    What if the numbers are of different lengths, and if those lengths are not powers of 2?

    • @STEMprof
      @STEMprof  Před 2 lety

      Thanks Bon for comment & questions. Answering them would require a separate video post :)

    • @adityabhattacharyya5971
      @adityabhattacharyya5971 Před rokem +1

      i think you put zeros on the left of the digits
      for example if the numbers are 1133568 and 583902, you make them 01122568 and 00583902

  • @christopherellis2663
    @christopherellis2663 Před rokem

    Four columns of digits 4²=16 multiplications ✖️
    KA,
    abcd
    defg.
    Pairs ab ac ad bc bd cd
    ad bc cf dg only 10 multiplication ✖️
    What is the point of complicating the procedure?

    • @wafikiri_
      @wafikiri_ Před 10 měsíci +1

      Sums in a computer take less time than multiplications, by far. In binary, numbers require many more digits than in decimal, and every multiplication of n × n binary digits requires n displacements to the right of one of the factors (division by 2, getting the residue) and n displacements to the left (multiplication by two) of the other factor, then adding it to the result each time the residue isn't 0 but 1, which is half the time on average: (n/2) sums, each sum involving n to 2n pairs of binary digits, 3n/2 pairs in average, plus adding the carry bit all the time (3n/2) whether it's 0 or 1: so, 3n additions by n/2 displacement steps makes 1.5 n² additions. Displacements take almost no time, adding does, so it's 1.5 × (n×single_binary_digits_addition_time)²; if we can get rid of 40% multiplications, even if we have to add and subtract 50% more, we get a significant reduction in overall multiplication time.

  • @xkm-thebasetecchannel3823

    So this makes multiplication much slower.

    • @MichaelCorlew
      @MichaelCorlew Před 2 lety +9

      For humans, yes. For computers, it makes it faster.

    • @STEMprof
      @STEMprof  Před rokem +1

      Thanks a lot MC

  • @TheSinisterPorpoise1
    @TheSinisterPorpoise1 Před rokem

    This is not a good explanation.

    • @STEMprof
      @STEMprof  Před rokem

      Thank you for watching this Karatsuba Algorithm video and for sharing your feedback. It would be helpful if you elaborate and explain which portion can be presented better.

  • @mentore6667
    @mentore6667 Před 3 lety +2

    very poor explained, especially when you change the (12+43)*(56+78) ==> (1200+43)*(5600+ 78) WHY THIS COMPARISION ???????

    • @STEMprof
      @STEMprof  Před 3 lety

      Thanks for your interest & comment. How would you improve the explanation then? What is your recommendation?

    • @zZE94
      @zZE94 Před 3 lety +2

      He didn't change it to that. That is just what Karatsuba found that using the digits that way results in one less multiplication.

    • @moali5279
      @moali5279 Před 2 lety

      It's essentially FOIL (First Outer Inner Last) from polynomial stuff (sorry haven"t dealt with algebraic terms for more than a decade)