# Question: Observe that the while loop of lines 5 7 of the

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 (see Exercise 2.3-5) instead to improve the overall worst-case running time of insertion sort to Θ(n lg n)?

**View Solution:**## Answer to relevant Questions

Describe a Θ (n lg n)-time algorithm that, given a set S of n integers and another integer x, determines whether or not there exist two elements in S whose sum is exactly x.Is 2n+1 = O (2n’’)? Is 22n = O (2n’’)?In HIRE-ASSISTANT, assuming that the candidates are presented in a random order, what is the probability that you will hire exactly twice?What are the minimum and maximum numbers of elements in a heap of height h?Show that quick sort's best-case running time is Ω (n lg n).Post your question