Question: Algorithm 2. MADEUPALGORITHM(A) Input: A, an n by n real valued matrix Let B = an n by n matrix initially zero Let s =

Algorithm 2. MADEUPALGORITHM(A)
Input: A, an n by n real valued matrix
Let B = an n by n matrix initially zero
Let s = 0
For i = 1 to n
For j = 1 to n
s = s + aij
End For
End For
s = s / n2
For i = 1 to n
For j = 1 to n
If aij > s Then bij = +1
If aij < s Then bij = -1
End For
End For
Output: Matrix B
1.6) Compute the operator count T(n) for the algorithm. Count all variable accesses (read and writes), mathematical operators (additions, multiplications, etc...), loops etc... Show all of your working out. Only do calculations for the numbered lines.
1.7) Derive the Big-O for Algorithm 1.
1.8) What does the algorithm do?
1.9) What are the limitations of analysing the runtime of algorithms and why can Big-O notation be much more suited for this task?

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!