Why is it significant that the number of times that line 5 is executed is equal to the number of inversions in the original array?

```
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. It tells us that the time complexity of insertion sort is always O( n ).
B. It can help us to analyze the time complexity of insertion sort, as long as this number can be put in terms of n.
C. It tells us that the time complexity of insertion sort is always O( n2 ).
D. It goes to show how much memory space is conserved with insertion sort.

B

Computer Science & Information Technology

You might also like to view...

________ involve conforming to established or accepted ideas of right and wrong

Fill in the blank(s) with correct word

Computer Science & Information Technology

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

1. All versions of Java support automatic boxing. 2. Wrapper classes are provided for all primitive Java types except Boolean.

Computer Science & Information Technology