Question: in Python 1. (70 pts) Strassen's Method Input: A positive integer n and two 2n2n matrices A and B. Output: Two 2n2n matrices C and

in Python in Python 1. (70 pts) Strassen's Method Input: A positive integer n

1. (70 pts) Strassen's Method Input: A positive integer n and two 2n2n matrices A and B. Output: Two 2n2n matrices C and D, and two positive integers s and t with the property that 1a) AB=C and AB=D. The difference is that C should be calculated with Strassen's method built from your own code and D should be calculated by the traditional method with your own code, and 1b) s counts the number of multiplications your algorithm does using Strassen's Method, and t counts the number of multiplications your algorithm does using the traditional methods. These numbers should be computed by your program with counters at appropriate places in the code, not just calculated according to what theory says. 2. ( 30 pts) Insertion Sort Input: Two positive integers n, and p,1pn2, and a list L of n real numbers. Output: The list sorted by Insertion Sort, and a view of the intermediate lists when the "active position" is the pth, the (p+1)st, and the (p+2)nd position ( 3 lists total). Indicate which number is in the active position for each of the three lists. Implementation Details You must build both of these algorithms from scratch in Python. The input for your first program should be able to accept a txt file with 3 lines, the first line representing the integer n and line two and line three are each the entries of a 2n2n matrix. Entries will be separated by a comma. The output should be printed to a file with the s and the t being on the first line and then the matrix C with entries separated by commas, followed by the matrix D written in the same format. The input for your second program should be a txt file having on the first line a positive integer representing n, the number of elements in the list to be sorted. The second line is a positive integer p (described above). The third line will be the list of integers, each separated by commas. Or for a few bonus points, your program can also query the user to input a p that will override the p in the file. The output should be to the console and conform to the description above. 1. (70 pts) Strassen's Method Input: A positive integer n and two 2n2n matrices A and B. Output: Two 2n2n matrices C and D, and two positive integers s and t with the property that 1a) AB=C and AB=D. The difference is that C should be calculated with Strassen's method built from your own code and D should be calculated by the traditional method with your own code, and 1b) s counts the number of multiplications your algorithm does using Strassen's Method, and t counts the number of multiplications your algorithm does using the traditional methods. These numbers should be computed by your program with counters at appropriate places in the code, not just calculated according to what theory says. 2. ( 30 pts) Insertion Sort Input: Two positive integers n, and p,1pn2, and a list L of n real numbers. Output: The list sorted by Insertion Sort, and a view of the intermediate lists when the "active position" is the pth, the (p+1)st, and the (p+2)nd position ( 3 lists total). Indicate which number is in the active position for each of the three lists. Implementation Details You must build both of these algorithms from scratch in Python. The input for your first program should be able to accept a txt file with 3 lines, the first line representing the integer n and line two and line three are each the entries of a 2n2n matrix. Entries will be separated by a comma. The output should be printed to a file with the s and the t being on the first line and then the matrix C with entries separated by commas, followed by the matrix D written in the same format. The input for your second program should be a txt file having on the first line a positive integer representing n, the number of elements in the list to be sorted. The second line is a positive integer p (described above). The third line will be the list of integers, each separated by commas. Or for a few bonus points, your program can also query the user to input a p that will override the p in the file. The output should be to the console and conform to the description above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!