646 views
2 votes
2 votes

A delivery boy at an online e-commerce company is charged with the task of rearranging a number of large crates in order of the time they are to be shipped out. Thus, the cost of compares is very low (just look at the labels of the items ) relative to the cost of exchanges (move the crates). The warehouse is nearly full: there is extra space sufficient to hold any one of the crates, but not two. Which sorting method should the boy use?

  1. heap sort
  2. quick sort
  3. selection sort
  4. randomized quick sort
     

1 Answer

Best answer
4 votes
4 votes
"The cost of compares is very low (just look at the labels of the items ) relative to the cost of exchanges (move the crates)."
So we will use selection sort because no of exchange (which is costelier in this case) in selection sort is O(n) only.
selected by
Answer:

Related questions

2 votes
2 votes
2 answers
2
Bikram asked Oct 4, 2016
346 views
$$T(n) = \begin{cases} 4 & \quad if \: \: n =1 \\ T(n-1) + 4 & \quad otherwise \end{cases}$$Value of $T(1000)$ is ___