Examine Following Pseudocode Line Numbered Leftmost Number Objective Exercise Determine T Q43814095
Examine the following pseudocode. Each line is numbered (leftmost number). The objective of this exercise is to determine the time complexity of this algorithm that takes as input an nxn matrix M and initialize it. We assume that the first line starts at i=1 and the first column starts at j = 1. First, this algorithm has a bug on line # [Select] Answer all the next questions assuming that the bug is corrected. Line #2 performs (Select] comparisons and n additions during the full execution of this algorithm. The assignment statement “M.. = 0.0” will be executed [Select] times. In total, the inner loop will perform (Select] comparisons. This total number of comparisons of this algorithm grows as n^2.This total number of comparisons, additions and assignment (M…=0.0) of this algorithm grows as [Select ] InitializeMatrixCM) 1: //Initialize Matrix to 0.0 for each element 2: for j = 1 to n 3: for i = 1 to n-1 4: M[i][j] = 0.0 5: return Answer 1: Answer 2: n+1 Answer 3: Answer 4: n^2 Answer 5: (n-1)n Answer 6: n^2 Answer 7: n^2 Show transcribed image text Examine the following pseudocode. Each line is numbered (leftmost number). The objective of this exercise is to determine the time complexity of this algorithm that takes as input an nxn matrix M and initialize it. We assume that the first line starts at i=1 and the first column starts at j = 1. First, this algorithm has a bug on line # [Select] Answer all the next questions assuming that the bug is corrected. Line #2 performs (Select] comparisons and n additions during the full execution of this algorithm. The assignment statement “M.. = 0.0” will be executed [Select] times. In total, the inner loop will perform (Select] comparisons. This total number of comparisons of this algorithm grows as n^2.This total number of comparisons, additions and assignment (M…=0.0) of this algorithm grows as [Select ] InitializeMatrixCM) 1: //Initialize Matrix to 0.0 for each element 2: for j = 1 to n 3: for i = 1 to n-1 4: M[i][j] = 0.0 5: return Answer 1: Answer 2: n+1 Answer 3: Answer 4: n^2 Answer 5: (n-1)n Answer 6: n^2 Answer 7: n^2
Expert Answer
Answer to Examine the following pseudocode. Each line is numbered (leftmost number). The objective of this exercise is to determin…
OR