Question: refer the attached python file assignment _ 2 . py ( make sure to NOT change the name of this file ) . Follow the

refer the attached python file assignment_2.py (make sure to NOT change the name of this file).
Follow the instructions and replace all TODO comments in the scaffolding code.
Do NOT change the function signature provided in the scaffolding code, but you can add as many functions as you want to help you complete the task.
Test your code as much as you can to make certain it is correct.
Create a write up with formatted code and screenshots of your output.
The code must be formatted as text and not as an image.
Save the write-up as a PDF and submit it along with your python code (file name assignment_2.py) as separate attachments before the due date
on canvas.
Failure to follow these instructions can disrupt the grading process, and
so it may result in substantial deductions to the overall score of the assignment of up to 25 points for each instruction.
Running flake 8(optional)
flake8 is a tool that can be used with Python to check your code for formatting and other potential issues. It can also provide information on the complexity of your code following McCabes cyclomatic complexity metric. This information is helpful for writing cleaner and more efficient code.
Examples of running flake8 from the command line:
flake8 path/to/your/file (for warnings and errors)
flake8--max-complexity 10 path/to/your/file (for complexity)
Note: running flake8 is optional and will not affect your grade.
Problem 1):
The Sun is the source of most of the energy that drives the biological and physical processes in the world around usin oceans and on land it fuels plant growth that forms the base of the food chain, and in the atmosphere, it warms air which drives our weather.
The rate of energy coming from the Sun changes slightly every second. However, NASA scientist want to focus on the most significant energy increase period in a day, so that they may get better understanding about the Sun. They have collected the measurement of the energy level in a range of time, starting from 0. Your task is to design a program finding the most significant energy increases period from their daily observation.
For example, they observed a sequence of energy level as follows, 100,113,110,85,105,102,86,63,81,101,94,106,101,79,94,90,97
Your program should return (7,11) since from element at index 7(63) to element at index 11(106) gives the most significant energy increase. Note that the indices start from zero.
In cases where each period shows a decrease over the previous period, then the most significant increase is the period of least decrease. For example, when given [110,109,107,104,100] your solution should return (0,1).
You need to implement a Python program to solve this problem using:
A. The brute-force method Q(n2).(Max Points: 10) B. The recursive method Q(nlogn).(Max Points: 25) C. The iterative method Q(n).(Max Points: 15)
Sample Input
[100,113,110,85,105,102,86,63,81,101,94,106,101,79,94,90,97]
Sample Output
(7,11)
NOTE: If there is a tie between two periods for the most increase, then either solution is accepted. For example, given [100,113,90,103] your solution should return either one, but not both, of the following: (0,1) or (2,3).
Problem 2:
Given a n n matrix A and a positive integer k, compute S = Ak.
The input contains the following
A matrix A containing n * n nonnegative integers (each less than 100).
You can assume that n 32 and is a power of 2, e.g.1,2,4,8,16,32.
A positive integer k (k 10).
You need to do the following tasks:
A. Implement a function to multiply two matrices using Strassen Matrix
Multiplication method Q(nlog27) :.
Compute S using the function (from A above) such that the number of
times the above function is called is Q(k).(Max Points: 10)
Compute S using the function (from A above) and the Divide & Conquer Approach such that the number of times the above function is called is
Q(log k).
Sample Input
[[0,1],[1,1]],3
Sample Output
[[1,2],[2,3]]
assignment.py -
refer the attached python file assignment _ 2 .

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 Programming Questions!