# Write programs of insertion sort, and mergesort

Original price was: \$35.00.Current price is: \$30.00.

Category:
Rate this product

Question 1 (2 pt.) Coding: write programs of insertion sort, and mergesort. Find the input size n, that
mergesort starts to beat insertion sort in terms of the worst-case running time. You can use clock_t
function (or other time function for higher precision) to obtain running time. You need to set your input
such that it results in the worst-case running time. Report running time of each algorithm for each input
size n.
Question 2 (1pt.) You are given with an array {10, 5, 7, 9, 8, 3}. Show the arrangement of the array for
each iteration during insertion sort. You are given with the same array. Show the arrangement of the array
for each iteration of the Partition subroutine and the result of Partition subroutine.
Question 3 (1pt.) True or False
� + 3 ∈ Ω(�)
� + 3 ∈ O(�))
� + 3 ∈ Θ(�))
2,-. ∈ O(� + 1)
2,-. ∈ Θ(2,)
Question 4 (1pt.) Using the master method, determine T(n) for the following recurrances.
�(�) = 8� 3

2
4 + �
�(�) = 8� 3

2
4 + �)
�(�) = 8� 3

2
4 + �5
�(�) = 8� 3

2
4 + �6
Question 5 (extra 1pt.) Draw recursion tree for �(�) = 8� 3
,
)
4 + �. And prove the obtained T(n) by
substitution method.

## Reviews

There are no reviews yet.

Scroll to Top