What is the time complexity for the following segment of code?
What will be an ideal response?
```
for (int factor1 = 1; factor1 <= n; factor1++)
{
for (factor2 = 1; factor2 < n; factor2++)
System.out.print(factor1*factor2 + " ");
System.out.println();
}
```
The complexity of each loop is O(n). Since the inner loop executes n times for each single execution of the
outer loop, the complexity is
Computer Science & Information Technology
You might also like to view...
The position of the lines of a paragraph relative to the page margins is the ________
A) indent B) line spacing C) orientation D) page layout
Computer Science & Information Technology
The _____ document contains the data that will be transformed using a style sheet.
A. ?source B. ?template C. ?output D. ?predicate
Computer Science & Information Technology