L is a list is of length n and it is sorted using insertion sort.

profilecybacatx
 (Not rated)
 (Not rated)
Chat

1. Suppose that L is a list is of length n and it is sorted using insertion sort. If Lis already sorted in the reverse order, show that the number of comparisonsis (1/2)(n2 – n) and the number of item assignments is (1/2)(n2 +3n) – 2.

2. Suppose that L is a list is of length n and it is sorted using insertion sort. If Lis already sorted, show that the number of comparisons is (n – 1) and thenumber of item assignments is 0.

    • 10 years ago
    (n2 – n) and the number of item assignments is (1/2)(n2 +3n) – 2.
    NOT RATED

    Purchase the answer to view it

    blurred-text