–1 –1 vote Which of the following is/are the status of the array after some iteration of a sorting algorithm, which sorting algorithm it might be? 14 42 17 72 12 10 5 1 1. Heap sort 2. Merge sort 3. Selection sort 4. Insertion sort Algorithms + – Anuj1995 1.6k views answer comment Share Follow Print See all 11 Comments 11 11 Comments reply Shaik Masthan commented Aug 30, 2018 reply Follow flag what is the initial array? 0 0 replyShare Anuj1995 commented Aug 30, 2018 reply Follow flag The question is only this. No initial array is given in the question. 0 0 replyShare Shaik Masthan commented Aug 30, 2018 reply Follow flag then close that question.... with out knowing the initial status of array, how can you derive the given status of array 0 0 replyShare sakharam commented Aug 30, 2018 reply Follow flag There is no problem with the question. 0 0 replyShare MiNiPanda commented Aug 30, 2018 reply Follow flag I think it can be selection or insertion.. The sorting type(increasing or decreasing order) is not mentioned..it can be anything..so I can assume both possibilities In selection sorting, we try to find the min element (or max depending on the type of sorting we are doing-ascending or descending) and put in at then end. I assume that the sorting here is descending. Then we find the 2nd min and put it in the 2nd last pos and so on.. In this array 14 42 17 72 12 10 5 1 ..it seems that upto the 4th min element iterations have been done i.e. 12 is placed in the correct place. In insertion sorting, upto 2nd place the sorting is done.. It is like sorting a subarray from pos 1 to kth place. (14,42) is sorted if we consider sorting as ascending one..) What is the answer given? 0 0 replyShare Shaik Masthan commented Aug 30, 2018 reply Follow flag why not heap? 14,42,17,72 ---- in Min Heap after taking out 1,5,10,12 0 0 replyShare MiNiPanda commented Aug 30, 2018 reply Follow flag Shaik Masthan Yes i think heap can be another possibility .. 0 0 replyShare Anuj1995 commented Aug 31, 2018 reply Follow flag All is the answer. 0 0 replyShare Shaik Masthan commented Aug 31, 2018 reply Follow flag if it is more than one iteration, then Mergesort can't be the answer. ( i am considering single element passes on 1st iteration ) 0 0 replyShare MiNiPanda commented Aug 31, 2018 reply Follow flag May be the array was initially like 42 14 72 17 12 10 5 1 (there might be other possibilites) If merge sort is also an answer then I guess the Division part of the divide and conquer mechanism has been done and then Merge is called for 2 times i.e. for merging (42),(14) to make it sorted to (14,42) and on (72),(17) to make it (17,72). 0 0 replyShare sakharam commented Aug 31, 2018 reply Follow flag Yes but only if they are using recursion Since they said iterations i assumed that iterative merge sort is used in which in first iteration pairs are sorted 0 0 replyShare Please log in or register to add a comment.