GATE | GATE-CS-2003 | Question 22

The usual Θ(n2) implementation of Insertion Sort to sort an array uses linear search to identify the position where an element is to be inserted into the already sorted part of the array. If, instead, we use binary search to identify the position, the worst case running time will

1)
2)
3)
become Θ(n log n)
4) become Θ(n)
(A) remain Θ(n2)
(B) become Θ(n (log n)2)
(C) become Θ(n log n)
(D) become Θ(n)


Answer: (A)

Explanation: See Question 1 of https://www.geeksforgeeks.org/data-structures-and-algorithms-set-6/

Also see Binary Insertion Sort


Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.