Two way merge sort algorithm is used to sort the following elements in ascending order.
Two way merge sort algorithm is used to sort the following elements in ascending order.
200, 470, 150, 80, 90, 40, 400, 300, 120, 70.
What is the order of these elements after second pass of the merge sort algorithm?
Show answerHide answer
Correct answer: (C) 80, 150, 200, 470, 40, 90, 300, 400, 70, 120
Explanation
Pass 1 merges pairs: (200,470)(80,150)(40,90)(300,400)(70,120). Pass 2 merges runs of two into fours: 80,150,200,470 | 40,90,300,400 | 70,120.