Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following piece of pseudocode: function NewMultiply(A,B,N) if(N == 0): return 0 else if (N = 1): return A[0]*B[0] h=floor(N/2) x=N mod 2

  

Consider the following piece of pseudocode: function NewMultiply(A,B,N) if(N == 0): return 0 else if (N = 1): return A[0]*B[0] h=floor(N/2) x=N mod 2 A1-new array (h+x) of zeroes B1=new array(h+x) of zeroes for x This piece of pseudocode computes the (decimal) integer obtained from multiplying the two arrays of length N storing bits. The operation floor (x) returns the largest integer smaller than or equal to x. (d) What is the worst-case time complexity of the function NewMultiply in terms of the length of the arrays N? Use Theta notation (1 mark) and show your working to arrive at this answer (6 marks). Assume that the floor of a number and x mod 2 can be computed in a constant number of time-steps. (7 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Organization and Design The Hardware Software Interface

Authors: David A. Patterson, John L. Hennessy

5th edition

124077269, 978-0124077263

More Books

Students also viewed these Programming questions

Question

Calculate the purchase price of each of the $1000 face value bonds

Answered: 1 week ago