When the nested loop of lines 8-11 is done executing, why is it that lines 10-11 will have been executed exactly n times?

```
1 COUNTING-SORT( A )
2 make an Array C of length k + 1
3 for each i, from 0 to k
4 C[ i ] = 0
5 for each j, from 0 to the length of A - 1
6 C[ A[ j ] ]++
7 j = 0
8 for each i from 0 to k
9 for each m from 1 to C[ i ]
10 A[ j ] = i
11 j++
```
A. C[i] will be 0 much of the time, but it will be equal to n one time
B. Each C[ i ] will be equal to n / (k + 1)
C. Array A has a blocker in it, which prevents more than n elements being written into it.
D. All the C[ i ], from i = 0 to i = k, when added together, will give the total number of elements in array A


D

Computer Science & Information Technology

You might also like to view...

The image on a monitor is called a hard copy

Indicate whether the statement is true or false

Computer Science & Information Technology

____ are normally replacements for older versions of software or firmware; they normally need to be purchased.

A. Updates B. Patches C. Upgrades D. Macros

Computer Science & Information Technology

The ____ is an ATM Forum specification for the protocols between switches in a private ATM network.

A. Private Network-Network Interface B. Private Network-Node Interface C. Private Node-Network Interface D. Private Node-Node Interface

Computer Science & Information Technology

A ________ are related data points represented by data markers.

a. data trends b. data lines c. data groups d. data series

Computer Science & Information Technology