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 (n+1)/2 times. Therefore, the growth function for the code fragment is n*((n+1)/2) = (n2 + n)/ 2. That is order n2.

```

Computer Science & Information Technology

You might also like to view...

Linux stores each file in the ____ directory.

A. /dev B. /etc C. /file D. /loc

Computer Science & Information Technology

The transmission speed of wireless personal area networks is higher than the other types of wireless networks.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The Small Caps effect is turned on in the ________ dialog box

A) Format task pane B) Paragraph C) Tabs D) Font

Computer Science & Information Technology

A gigahertz is cycles per second

A) 100,000 B) 1,000,000 C) 1,000,000,000 D) 1,000,000,000,000

Computer Science & Information Technology