Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ONLY PART E) and F) PLEASE NEAT HANDWRITING ONLY THANK YOU 3. (18 points) In class, we discussed the Russian Peasant Multiplication (RPM) algorithm. The
ONLY PART E) and F) PLEASE
NEAT HANDWRITING ONLY
THANK YOU
3. (18 points) In class, we discussed the Russian Peasant Multiplication (RPM) algorithm. The pseudo-code implementation of this algorithm is: procedure RPM(m: real number;n: positive integer) 1. total :0 2. am 4. while b> 1 5. if (b mod 2-1) then total-total + a 7. b:-b div 2 8. return total a (a.) Trace (i.e. walk through) an example of the operation of this algorithm when m 714 and n- 64 (b.) Convert m-714 and n 64 to binary notation (c.) Multiply m 714 and n-64 using the usual school algorithm for long multiplication (but in base 2 instead of decimal) (d.) Convert your answer from part (c) back to decimal, and compare to part (a). (e.) Explain how the steps in parts (a) and parts (c) correspond to one anotheir. (f.) Trace the RPM algorithm but now with m- 64 and n -714. Discuss the difference between this computation and part (a). Generalize your observation to come up with a general principle for choosing which number to pick as m and which number to pick as n when you want to combine the product of two positive integers and y. 3. (18 points) In class, we discussed the Russian Peasant Multiplication (RPM) algorithm. The pseudo-code implementation of this algorithm is: procedure RPM(m: real number;n: positive integer) 1. total :0 2. am 4. while b> 1 5. if (b mod 2-1) then total-total + a 7. b:-b div 2 8. return total a (a.) Trace (i.e. walk through) an example of the operation of this algorithm when m 714 and n- 64 (b.) Convert m-714 and n 64 to binary notation (c.) Multiply m 714 and n-64 using the usual school algorithm for long multiplication (but in base 2 instead of decimal) (d.) Convert your answer from part (c) back to decimal, and compare to part (a). (e.) Explain how the steps in parts (a) and parts (c) correspond to one anotheir. (f.) Trace the RPM algorithm but now with m- 64 and n -714. Discuss the difference between this computation and part (a). Generalize your observation to come up with a general principle for choosing which number to pick as m and which number to pick as n when you want to combine the product of two positive integers and yStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started