sorting efficency of sorting algorithm
Posted on 2016-10-14
we all can agree that in a pure sorting methodology, the good old quick sort is likely best.
this assumes a 0 cost for actually moving the element from one sorting position to another.
my question is... what sorting algorithm would be best if there was a cost associated with actually moving the item to its new sorting positon.
lets define the cost as how far the current element is from the element it is replacing. or the position it is moving to.
what i am trying to do is to put a value on the amount of "work" involved in doing the sort.
does anyone know of a simple set of code that would show this "work load"
basically it would involve adding a counter that increments a value by the distance the element moved in the sort
the sort types i am most intereested in are bucket, insertion, and quick sort