Big O Calculations for Matrix Operations

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

How many total operations do you have when multiplying two 4X4 matrices?

112

Suppose that you want to multiply two matrices A, which is 4x6, and B, which is 6x7. How many multiplications will be required?

168

How many addition operations do you have when multiplying a 7X8 matrix by a 8X5 matrix?

175

If you add two matrices A, which is 12 × 6, and B, which is 12 × 6, how many nested loops will be required?

2

How many multiplication operations do you have when multiplying a 7X8 matrix by an 8X5 matrix?

280

How many addition operations do you have when adding two 6X8 matrices?

48

How many addition operations do you have when multiplying two 4X4 matrices?

48

If you add two matrices A, which is 12 × 6, and B, which is 12 × 6, how many additions will be required?

72

Suppose that you want to multiply two matrices A, which is MxN, and B, which is NxP. How many additions will be required?

M(N-1)P

Suppose that you want to multiply two matrices A, which is MxN, and B, which is NxP. How many multiplications will be required?

MNP

Which one of the following has the largest big O notation value?

Multiplying two nXm matrices

Suppose that you want to multiply two matrices A, which is MxN, and B, which is PxQ, where N!=P. How many multiplications will be required?

Not possible

A sparse matrix is one that is mostly zeroes, with only a few nonzero entries. Suppose that you store this by keeping a list of triples, with each triple having the row, column, and value of each nonzero cell. Suppose that A and B are sparse MxN matrices and that the nonzero elements of each are stored as a sorted list of triples of length a and b, respectively. What is the time complexity to add A and B?

O(a + b) because the lists are sorted and merging only requires looking at each element of both lists

A sparse matrix is one that is mostly zeroes, with only a few nonzero entries. Suppose that you store this by keeping a list of triples, with each triple having the row, column, and value of each nonzero cell. Suppose that A and B are sparse MxN matrices and that the nonzero elements of each are stored as an unordered list of triples of length a and b, respectively. What is the time complexity to add A and B?

O(ab) because for each element of A, you have to check if there is a nonzero element of B to add

What is the big O notation for adding or subtracting two vector matrices?

O(n)

What is the big O notation of multiplying two diagonal matrices?

O(n2)

If you add two matrices A, which is 12 × 6, and B, which is 12 × 6, how many loop tests and set operations will be required?

The outer loop on the rows will require 12 increments and 12 test operations, and each inner loop on the columns will require six increments and six test operations, for a total of 84 each. - or - The outer loop on the columns will require six increments and six test operations, and each inner loop on the columns will require 12 increments and 12 test operations, for a total of 78 each.

Which of the following represents the size of a vector matrix having n elements?

n x 1

How much storage does it take to store an matrix if one memory location is allocated to each position in the matrix? Alternatively, what is the Big O space complexity of the storage?

n^2


Set pelajaran terkait

Negotiations - The Who, Stakes, and Situation + Strategy Chart

View Set

Tema: Hur känner du dig idag? - How are you feeling today?

View Set

Exploring Religious Meaning Midterm

View Set

Project Management: Ch 5 quiz Qs

View Set