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
Last Updated :
28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...