Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) (3 marks] The algorithm below takes in two matrices with integer entries, and computes A*B. Matrix A has m rows and k columns, where

image text in transcribed
image text in transcribed
(a) (3 marks] The algorithm below takes in two matrices with integer entries, and computes A*B. Matrix A has m rows and k columns, where m > 0 and k >0. Matrix B has k rows and n columns, where k > 0 and n > 0. Notice that the number of rows in B is equal to the number of columns in A (this is required in order to perform matrix multiplication) Your task: For Algorithm 4 below, calculate the number of times that two integers are multiplied together. In particular, your answer should be a function gm, k, n) defined by a formula in terms of m, k, n (as defined above). Algorithm 4 matrixMult (int UU A, B) 1: m A. num Rows 2: K + A. numColumns 3: n B. num Columns 4: C empty matrix with mrows and n columns 5: for (int i= 0;ii (where i is a row number and j is a column number). Re-write Algorithm 4 from part (a) of this question, but assume that the input matrices A and B are both upper triangular with n rows and n columns. Your algorithm should avoid performing line 9 whenever Alo Ball) will evaluate to ii. 15 marks) Calculate the worst-case number of times that two integers are multiplied together when your new algorithm from part i. is performed on two upper triangular matrices. In particular, your answer should be a function h(n) defined by a formula in terms of n, where n is the number of rows and columns in each input matrix<>

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

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions