Question: asap please solve this asap Examine the pseudocode for the function MULT(a,b) given below, and then answer all questions in Port Al Part 8) and
Examine the pseudocode for the function MULT(a,b) given below, and then answer all questions in Port Al Part 8) and Part. Make sure to dearly indicate which part(s) you are answering MULT(a,b) // Returns ab, where and are positive integers 2 3 4 5 6 7 8 9 10 11 yo prodo while > 0 WODD(2) prod-prod+ - 12/2) 2 return prod Part A) [6] The loop invariant for the white loop starting at line 6 is given by > and prod+ya.b Prove the loop is correct using the given loop invariant Part 3) 131 Show that the loop terminates at which point the prod is set to b. Part 1] What is the minimum and maximum number of times line 8 is executed. Provide your answer as a function of a where applicable Justify your answer Examine the pseudocode for the function MULT(a, b) given below, and then answer all questions in Part. A), Part B), and Part. Make sure to clearly indicate which part(s) you are answering. 2 3 4 5 6 MULT(a,b) // Returns ab, where a and b are positive integers I-a y=0 prod=0 while I > 0 if ODD() prod prody 3/2) v = 2. return prod 7 8 9 10 11 Part A) [6] The loop invariant for the while loop starting at line 6 is given by: I >=0 and prod +2.y=a.6 Prove the loop is correct using the given loop invariant Part B) B) Show that the loop terminates, at which point the prod is set to a.. Part 1) What is the minimum and maximum number of times line 8 is executed. Provide your answer as a function of a where applicable Justify your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
