Tuesday, July 28, 2009

. If in insertion sort we use binary search to identify the position, the worst case running time will?

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


a.remain O(n2)


b.become O(n(log n) 2)


c.become O(n log n)


d.become O(n)

. If in insertion sort we use binary search to identify the position, the worst case running time will?
Well it will become ... Log(base 2) n ....


see the reference lecture (.pdf) for details....

garden flowers

No comments:

Post a Comment