Question: Long multiplication and Karatsuba multiplication algorithms. This should be done in C++ A262: Lab 4 Program Speciications Implement the following algorithms. Put them in separate

Long multiplication and Karatsuba multiplication algorithms. This should be done in C++A262: Lab 4 Program Speciications Implement the following algorithms. Put them inLong multiplication and Karatsuba multiplication algorithms. This should be done in C++

A262: Lab 4 Program Speciications Implement the following algorithms. Put them in separate functions. (You don't necessarily have to use arrays). You should include a counter in the algorithm that keeps count of the number of mathematical operations the algorithm requires. For the purposes of the counter, do not include the for loop operations. For example, this line of code: product[ai + bi 1] carry + alai] b[b.i] would require 5 operations (three additions, one subtraction, and one multiplication) Your program should run an experiment using these algorithms. Using two integers with 1, 2, 3, 4, and 5 digits, track how many operations each algorithm takes to complete the multiplication Then print out a table showi multiplied together, the product, how many operations the long multiplication took, and how many operations Karatsuba's algorithm took Submit a pdf of a screenshot of your program running ng your results. The table should have columns for the numbers you Algorithms Long Multiplication (base refers to the number base, i.e. base 10 for decimal, base 2 for binary) Reference: https://en.wikipedia.org/wiki/Multiplication algorithm Note these arrays start at 1 multiply (al1. .p] , b[i..q], base) // Operands containing rightmost digits at index 1 [1.. p+q] 1 to q; do //Allocate space for result product for b-i = // for all digits in b = carry = 0 for a-i = 1 to p; do //for all digits in a product[a i bi 1] carry + a[a_i] blb_i] carry - product [a i + b_i 1] / base product la-1 + b_1-1] -product [a_1 + b_1-1] mod base done product [b_i p +- carry // last digit comes from final carry done return product Karatsuba Multiplication Reference: https://en.wikipedia.org/wiki/Karatsuba.algorithm#Algorithm procedure karatsuba(num1, num2) if (num1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!