Better sorting technique for almost sorted list -
which best sorting technique sorted list , why? list of many elements found quick sort helpful.but sort have better running time when sorted?
insertion sort has linear performance when list sorted.
check : http://www.sorting-algorithms.com/nearly-sorted-initial-order
insertion places element @ correct position considering relative ordering hence need n - 1 iterations. other sorts quick sort again tries sort sorted segment again unaware of relative ordering (ie if segment sorted).
Comments
Post a Comment