Question: Perform the simplified runtime analysis of the following algorithm and identify its complexity. Show your work. public void example(int n, String[][] someArray) { int sum
Perform the simplified runtime analysis of the following algorithm and identify its complexity. Show your work.
public void example(int n, String[][] someArray) {
int sum = 0;
System.out.println(n);
for (int c=0; c < n, ++c)
System.out.printf(%d ,c);
sum = sum + c;
}
System.out.printf( Sum: %d , sum);
System.out.println(----Array contents----);
for (int c1=0; c1 < someArry.length; ++c1) {
for (int c2=0; c2 < someArray[c1].length; ++c2) {
System.out.println(someArray[c1][c2]);
}
}
System.out.print(----End of array contents----);
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
