The naive approach solves the matrix multiplication problem in O(n3) time. In order to improve the time complexity(make a smaller number of multiplications) we have Strassen Algorithm. For the matrix given below, it will
have 7 multiplications instead of 8.
The seven multiplications for the given matrix will be:
p1= A*(F-H) ----- 1
p2= (A+B)*H ----- 2
p3= (C+D)*E -----3
p4= D*(G-E) ----4
p5= (A+D)*(E+H)----5
p6= (B-D)*(G+H)----6
P7= (A-C)* (E+F)
SOLVE THE VALUES INSIDE BRACKET FIRST THEN MULTIPLY.
=
So overall it will take 7 multiplications. The function will be called recursively to perform these 7 multiplications, to instances half the size.
The recurrence relation for performing Strassen Algorithm is:
T(n)= 7T(n/2) + O(n2),
which when solved using the Master's theorem is O(NLog7) which is approximately O(N2.8074). This time complexity O(N2.8074), is asymptotically better/faster than O(n3) because of the lesser number of multiplications.
Though it's time complexity is less, it is not used much because of the complexity in solving this(by hand), and the recursion employed in Strassen Algorithm takes extra space.
I already solved part A and I just need help with part B 1. Matrix Multiplication...
Question #4 (15 points) In class, we discussed a divide-and-conquer algorithm for matrix multiplication that involved solving eight subproblems, each half the size of the original, and performing a constant number of e(n) addition operations. Strassen's Algo- rithm, which we did not cover, reduces the number of (half-sized) subproblems to seven, with a constant number of e(n) addition and subtraction operations. Provide clear, concise answers to each of the following related questions. • (7 points). Express the runtime of Strassen's...
4.5-2 Professor Caesar wishes to develop a matrix-multiplication algorithm that is asymptotically faster than Strassen’s algorithm. His algorithm will use the divide- and-conquer method, dividing each matrix into pieces of size n/4 x n/4, and the divide and combine steps together will take O(n) time. He needs to determine how many subproblems his algorithm has to create in order to beat Strassen’s algo- rithm. If his algorithm creates a subproblems, then the recurrence for the running time T(n) becomes T(n)...
** Use Java programming language Program the following algorithms in JAVA: A. Classical matrix multiplication B. Divide-and-conquer matrix multiplication In order to obtain more accurate results, the algorithms should be tested with the same matrices of different sizes many times. The total time spent is then divided by the number of times the algorithm is performed to obtain the time taken to solve the given instance. For example, you randomly generate 1000 sets of input data for size_of_n=16. For each...
Question 1. Solving Recursive Relations [3 mark]. A naive multiplication of two matrices of order n requires O(nᵒ) additions. By using a divide and conquer approach, Strassen devised another algorithm that requires T(n) additions where T(n) = 7T(n/2)+cna, where c is a constant independent of n and T(1) = 0 (as multiplying two numbers re- quires no additions). Use the method of backward substitution (introduced in Week 2's lecture) to show that Strassen’s algorithm requires O(nlog27) = O(n2.81) additions, which...
I will upvote if u will solve What u need? DFT can also be obtained using matrix multiplication. Let X[r] show the transformed values and x[n] show the original signal. Using the analysis equation: Using matrix multiplication, this operation can be written as x[O X[1 1 e(2m/N) e-K4n/N) x12] [N-1]] e-j(2(N-1)T/N)e-j(4(N-1)m/N) Instead of huilt-in EFT function use matrix multinlication to solve 3th auestion [ 1 e-/(2(N-1)(N-1)T/N)]Le[N-1] DFT is an extension of DTFT in which frequency is discretized to a finite...
(a) Suppose we want to solve the linear vector-matrix equation Ax b for the vector x. Show that the Gauss elimination algorithm may be written bAbm,B where m 1, This process produces a matrix equation of the form Ux = g , in which matrix U is an upper-triangular matrix. Show that the solution vector x may be obtained by a back-substitution algorithm, in the form Jekel (b) Iterative methods for solving Ax-b work by splitting matrix A into two...
7. (10) Given an array of integers A[1..n], such that, for all i, 1 <i< n, we have |Ali]- Ali+1]| < 1. Let A[1] = and Alny such that r < y. Using the divide-and-conquer technique, describe in English algorithm to find j such that Alj] z for a given value z, xz < y. Show that your algorithm's running time is o(n) and that it is correct o(n) search an 2 8. (10) Solve the recurrence in asymptotically tight...
If someone can help with 3 3) To multiply 2 n bit binary numbers the straightforward way takes (r) time because each digit of each number multiplies each digit of the other number. (The aditions from carying are lower order terms.) Consider the following divide- and-conquer algorithm, which assumes, for simplicity, that n is a power of 2: Split each number into 2 collections of bits, the high order bits and the low order bits. For convenience, call the two...
Please solve using Java and comment your code for clarity. Sample 3. Input: 4 1 231 Output: 0 This sequence also does not have a majority element (note that the element 1 appears twice and hence is not a majority element). Problem Introduction Majority rule is a decision rule that selects the alternative which has a majority, that is, more than half the votes. Given a sequence of elements (1.02....,On, you would like to check whether it contains an element...
Hi, I need help with the following question: Let S be a sequence of N elements on which a total order relation is defined. Recall that an inversion in S is a pair of elements x and y such that x appears before y in S but x > y. Describe an algorithm running in O(n log n) time for determining the number of inversions in S.