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? heap sort quick sort selection sort randomized quick sort Algorithms go-alogrithms-1 + – Bikram asked Oct 4, 2016 Bikram 646 views answer comment Share Follow See 1 comment See all 1 1 comment reply shadymeee commented Jan 19 reply Follow Share why not heap sort? 0 votes 0 votes Please log in or register to add a comment.
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. Digvijay Pandey answered Oct 11, 2016 selected Oct 11, 2016 by Arjun Digvijay Pandey comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments Arjun commented Oct 30, 2016 reply Follow Share Why we need to move O(n) elements at each iteration in selection sort? 0 votes 0 votes Sushant Gokhale commented Oct 30, 2016 reply Follow Share Sorry Arjun. My bad. Got it 1 votes 1 votes Sushant Gokhale commented Oct 30, 2016 reply Follow Share messed with insertion sort :D 0 votes 0 votes Please log in or register to add a comment.