Binary Insertion Sort - Take this Array => {4, 5, 3, 2, 1}
Now inside the main loop, imagine that we are on the third element. Now with the help of binary search we will know where to insert 3, i.e. up to 4.
Binary search uses O (Logn) comparison, which is an improvement, but we still need to insert 3 in the right place. To do this, we need to change 3 from 5, and then from 4.
Due to the fact that the insertion takes as much time as without a binary search, in the worst case, the complexity still remains O (n ^ 2). Hope this helps.
source share