Determine the growth function and order of the following code fragment:
What will be an ideal response?
```
for (int count = 0; count < n; count ++)
{
for (int count2 = 0; count2 < n; count2 = count2 * 2)
{
System.out.println(count, count2);
}
}
```
The outer loop will be executed n times. The inner loop will be executed log n times. Therefore, the growth function for the code fragment is n*(log n). That is order n log n.
Computer Science & Information Technology
You might also like to view...
________ Web Parts are saved separately from the page in the SQL Server content database
Fill in the blank(s) with correct word
Computer Science & Information Technology
A(n) ________ marks the end of one section and the beginning of the next
Fill in the blank(s) with correct word
Computer Science & Information Technology