Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve this C language problem ( c ) ( 5 points ) Suppose the recursive calls on lines 2 0 - 2 3 are replaced

Solve this C language problem (c)(5 points) Suppose the recursive calls on lines 20-23 are replaced with the following
code:float M2[]= matmul(A21+ A22, B11, N/2);
float M3[]= matmul(A11, B12- B22, N/2);
float M4[]= matmul(A22, B21- B11, N/2);
float M5[]= matmul(A11+ A12, B22, N/2);
float M6[]= matmul(A21- A11, B11+ B12, N/2);
float M7[]= matmul(A12- A22, B21+ B22, N/2);and the return statement on line 25 is replaced with:
return [[M1+ M4- M5+ M7, M3+ M5],
[M2+M4,M1-M2+M3+M6]
Note that this computes the same result! Use big- notation to express the new
number of float/float multiplies in terms of the size N.(Hint: write a new recurrence
relation).
Consider the following pseudocode that recursively multiplies two NN matrices by
breaking them into eight N2N2 matrix multiplies:// base case return [A[0,0]* B [0,0]];// get A submatricesfloat A12[]= A[:N/2, N/2:];float A22[]= A[N/2:,N/2:];float B11[]= B[:N/2, :N/2];float B21[]= B[N/2:, :N/2];// make recursive callsfloat C12[]= matmul(A12, B22, N/2)+ matmul(A11, B12, N/2);float C22[]= matmul(A21, B12, N/2)+ matmul(A22, B22, N/2);}For simplicity, you may assume that N is a power of two.
(a)(3 points) Write a recurrence relation that describes the number of times the above
algorithm multiplies two floats (line 4) as a function of N.
(b)(2 points) Use the Master Theorem to compute a big- closed form of your recur-
rence relation from part (a). Show all intermediate steps.
image text in transcribed

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

2. Define communication.

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago