What is the time complexity? Algorithm 3: Strassen's Matrix Multiplication Algorithm Input: A = and B = ERX A. 22 B23 1: if n = 1 then 2: C = AB 3: else 4: M = A + AB + B 5: M = A + AB 6: M = A.B - B 7: M = AB - B 8: M = A + AB 2 9: M = A - AB + B 10: M = A - AB + B 11: 12: C2 = M + M 13: C = M + M 14: = M - M + M + M Cu C2 Output: AB = C = ERXn Ca1 C
Added by Celia N.
Close
Step 1
Line 1 checks if the size of the matrices A and B is 1. This operation takes constant time, so it has a time complexity of O(1). Show more…
Show all steps
Your feedback will help us improve your experience
Robert Fox and 88 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
In matrix (nxn) multiplication algorithms, the time and space complexity are given as: time complexity O(n^3) and space complexity O(n^2). Assuming we're using 1000 processors to compute the matrix multiplication, does this affect the space and time complexity?
Madhur L.
If $A$ and $B$ are $n$ by $n$ matrices with all entries equal to 1 , find $(A B)_{i j}$. Summation notation turns the product $A B$, and the law $(A B) C=A(B C)$, into $$ (A B)_{i j}=\sum_{k} a_{i k} b_{k j} \quad \sum_{j}\left(\sum_{k} a_{i k} b_{k j}\right) c_{j l}=\sum_{k} a_{i k}\left(\sum_{j} b_{k j} c_{j l}\right) $$ Compute both sides if $C$ is also $n$ by $n$, with every $c_{j t}=2$.
Matrices And Gaussian Elimination
Matrix Notation and Matrix Multiplication
Algorithm-3 recursive function MaxSum(X[L..U]: array of integers, L, U: integers) 1. if L > U then return 0 /* zero-element vector */ 2. if L = U then return max(0, X[L]) /* one-element vector */ 3. M = (L + U) / 2 /* A is X[L..M], B is X[M+1..U] */ /* Find max crossing to the left */ 4. sum = 0; maxToLeft = 0 5. for I = M downto L do 6. sum = sum + X[I] 7. maxToLeft = max(maxToLeft, sum) /* Find max crossing to the right */ 8. sum = 0; maxToRight = 0 9. for I = M + 1 to U 10. sum = sum + X[I] 11. maxToRight = max(maxToRight, sum) 12. maxCrossing = maxToLeft + maxToRight 13. maxInA = maxSum(X, L, M) 14. maxInB = maxSum(X, M + 1, U) 15. return max(maxCrossing, maxInA, maxInB)
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD