How many swaps will be required in the worst case to sort an array having n elements using binary insertion sort?

How many swaps will be required in the worst case to sort an array having n elements using binary insertion sort?
A. n
B. 1
C. n * log n
D. log n
 
Answer: d
Explanation: In a normal insertion sort at most n comparisons are required to sort the array. But if we also implement the concept of a binary sort in insertion sort then we can sort by having log n comparisons only.
 

Tìm kiếm

Back
Top