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

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -