there is no "index array" these items physically must be picked up and moved.the methods using an index array means that you do the sorting in two phases: a sorting phase where you only find out the new positions of each item, and then a second moving phase.
7) Can one person (or machine) carry more than one piece at a time, or can he gather, say, 10 pieces that belong to one owner and move them to their final destination?From these answers and all the others, I think we consider all items to have the same weight, and "work" can be defined as the total distance traveled by the one person moving the items from the array to the containers, where each container is associated with one of the owners. But one point is not clear to me.
-- for the purposes of this exersise, i am trying to determine "work" of an algorithm
8b) If weight is not a factor, then are you trying to minimize the total distance a person (or machine) travels to complete the sort?
-- i think the answer is yes
The travelling salesman problem (TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?"There are some nice animations in the above link to further your understanding.
https://en.wikipedia.org/wiki/Travel ling_sales man_proble m
then are you trying to minimize the total distance a person (or machine) travels to complete the sort?don't think that is true. it is not the total travel distance but the total transport distances. if only one piece can be transported at a time, the total transport distance is constant for a given Distribution granted we know the final position of each piece.
But, going back to your original statement in the OP:
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.
Title | # Comments | Views | Activity |
---|---|---|---|
Incorrect group by on LINQ query | 5 | 26 | |
I need C# converted to VB.net | 1 | 52 | |
i want to booking the car. how to change the available to no and transfer the data into booking table | 6 | 65 | |
Code enhancement | 5 | 12 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
9 Experts available now in Live!