0 votes 0 votes Consider the following scenario during insertion sort when the array looks like the following: {25,75,95,125,80,5,10} The number of comparisons that it will further take for the array to be completely sorted are______? Algorithms algorithms sorting made-easy-test-series + – Somoshree Datta 5 asked Oct 20, 2018 • edited Mar 3, 2019 by Aditi Singh Somoshree Datta 5 1.6k views answer comment Share Follow See all 8 Comments See all 8 8 Comments reply Show 5 previous comments Somoshree Datta 5 commented Oct 20, 2018 reply Follow Share @Deepanshu Yes now it got cleared..Thank u :) 0 votes 0 votes MiNiPanda commented Oct 20, 2018 reply Follow Share The question uses the word "during" insertion sort, "further" comparisons and then the solution doesn't consider them!! :/ Also it is not clear as up to which element comparison has been done. I mean if the initial array was like {75,25,95,125,80,5,10} then 1st iteration will take key as 25 and make the array like {25,75,95,125,80,5,10} (i.e. the one given in the question). If this is the case then we have to start solving by taking key=95. Though at first I also assumed key to be 80. To me it is not a well framed question :/ 0 votes 0 votes Somoshree Datta 5 commented Oct 20, 2018 reply Follow Share @MiniPanda Yes they shouldnt have mentioned the line "further comparisons needed"..instead just asking the number of comparisons required for insertion sort on the given array wouldn't have led to any confusion! 0 votes 0 votes Please log in or register to add a comment.
2 votes 2 votes Getting 17 as the answer. Questioner should confirm nephron answered Oct 20, 2018 nephron comment Share Follow See 1 comment See all 1 1 comment reply Somoshree Datta 5 commented Oct 20, 2018 reply Follow Share ya 17 is the answer 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes It is given that “The number of comparisons that it will further take for the array to be completely sorted are” Hence it means that some of the array was already sorted (first 4 elements). Hence I think we need to answer the no of comparison for the last unsorted elements, DAWID15 answered Dec 21, 2021 DAWID15 comment Share Follow See all 0 reply Please log in or register to add a comment.