# COT6405 Assignment 1 solution

\$35.00

Original Work ?
Category:

## Description

5/5 - (1 vote)

Assignment 1 (10 points for each question)

1. Exercise 2.3-1: Using Figure 2.4 as a model, illustrate the operation of merge sort on the
array A = {3, 41, 52, 26, 38, 57, 9, 49}

2. Exercise 2.3-6: Observe that the while loop of lines 5 β 7 of the INSERTION-SORT
procedure in Section 2.1 uses a linear search to scan (backward) through the sorted
subarray A[1β¦j-1]. Can we use a binary search instead of a linear search to improve the
overall worst-case running time of insertion sort to Ξ(πlgπ)?

3. For the MERGE function, the sizes of the L and R arrays are one element longer
than π1 and π2, respectively. Can you rewrite the merge function with the size
of L and R exactly equal to π1 and π2?
4. Prove that π
1
π β Ξ(π
π‘
) (t > 0)
5. Express the function π
3
100
β 50π β 100πππ in terms of Ξ notation.

6. Exercise 3.1-6 Prove that the running time of an algorithm is Ξ(g(π)) if and only
if its worst-case running time is O(g(n)) and best-case running time is Ξ©(π(π)).

7. Which is asymptotically larger: lgn or βπ? Please explain your reason.

8. Prove that π