Why is one condition on line 4 “i is greater than -1”?

```
1 for each j, from 1 to the length of A – 1
2 temp = A[ j ]
3 i = j – 1
4 while i is greater than -1 and A[ i ] is greater than temp
5 A[ i + 1 ] = A[ i ]
6 i—
7 A[ i + 1] = temp
```
A. -1 is not a valid index of an array
B. if i has been set to -1, it means the array is already sorted
C. if i is -1, we cannot do any more one-assignment swaps, so we must exit the loop
D. if i is -1, it means the array cannot be sorted


C

Computer Science & Information Technology

You might also like to view...

To define styles under landscape orientation, use the @media rule, setting the orientation to ____.

A. landscape B. portrait C. normal D. page layout

Computer Science & Information Technology

Which of the following is NOT true in regard to data validation rules?

A) Data that does not follow data validation rules can negatively affect business processes. B) Once you establish validation rules, they will be accurate for the life-time of the database. Thus, you do not need to periodically evaluate data validation rules. C) Errors in data validation can lead to data corruption or security vulnerability. D) The goal of using data validation rules is to force users entering data to safeguard the validity of the data.

Computer Science & Information Technology

The TCP protocol works at the network layer of the OSI model

Indicate whether the statement is true or false.

Computer Science & Information Technology

A text file contains only text and numbers without any formulas, special fonts, graphics, or formatted text.? ?

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

Computer Science & Information Technology