Karatsuba Algorithm Explained with Examples
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
I don't know why geeks for geeks and Briliant use such confusing math jargon. This video helps lots!
Thanks Zeon! glad that video is helpful.
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
Appreciate your comment & feedback. Glad to hear that the video is helpful.
It helped me in my research, thanks for the video
Thanks Srikanth. Appreciate your comment.
Thank you for the break down and great explanation
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. 🙋♂️
Thank you for this great explanation.
You are welcome. Thank you for watching. Glad that this Karatsuba Algorithm video is helpful.
thank you for ur help 🙏
You are welcome! Glad that this video is helpful.
@@STEMprof pls provide Toom Cook3 multiplication as well 🙏🏼
@@amisaraaah yes sir
@@amisaraaah Sure, Toom-Cook (Toom3) Algorithm Explained with Examples (Generalization of Karatsuba Algo) in this follow-up video: czcams.com/video/1XiSyNzMX6Q/video.html
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.
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. 🙋♂️
What if the numbers are of different lengths, and if those lengths are not powers of 2?
Thanks Bon for comment & questions. Answering them would require a separate video post :)
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
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?
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.
So this makes multiplication much slower.
For humans, yes. For computers, it makes it faster.
Thanks a lot MC
This is not a good explanation.
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.
very poor explained, especially when you change the (12+43)*(56+78) ==> (1200+43)*(5600+ 78) WHY THIS COMPARISION ???????
Thanks for your interest & comment. How would you improve the explanation then? What is your recommendation?
He didn't change it to that. That is just what Karatsuba found that using the digits that way results in one less multiplication.
It's essentially FOIL (First Outer Inner Last) from polynomial stuff (sorry haven"t dealt with algebraic terms for more than a decade)